Click here to Skip to main content
15,918,706 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Working with dynamically created controls Pin
Anuradha61230-Dec-07 19:11
Anuradha61230-Dec-07 19:11 
GeneralRe: Working with dynamically created controls Pin
N a v a n e e t h30-Dec-07 19:09
N a v a n e e t h30-Dec-07 19:09 
GeneralRe: Working with dynamically created controls Pin
N a v a n e e t h30-Dec-07 19:07
N a v a n e e t h30-Dec-07 19:07 
GeneralRe: Working with dynamically created controls Pin
Anuradha61230-Dec-07 19:16
Anuradha61230-Dec-07 19:16 
GeneralRe: Working with dynamically created controls Pin
N a v a n e e t h30-Dec-07 19:41
N a v a n e e t h30-Dec-07 19:41 
GeneralRe: Working with dynamically created controls Pin
rahul.net1130-Dec-07 19:40
rahul.net1130-Dec-07 19:40 
GeneralRe: Working with dynamically created controls Pin
Paul Conrad31-Dec-07 5:56
professionalPaul Conrad31-Dec-07 5:56 
GeneralRe: Working with dynamically created controls Pin
Imran Khan Pathan30-Dec-07 19:52
Imran Khan Pathan30-Dec-07 19:52 
Look at this example
I create two textboxes and dropdownlist on page load event.
I have one Button and one placeholder on the page.
On page load event,add all dynamically created in place holder and on button click event, I get values of the textboxes and selected value of dropdownlist.
protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        CreateControls(); <br />
    }<br />
    public void CreateControls()<br />
    {<br />
        TextBox MyTxt1=new TextBox();<br />
        MyTxt1.ID = "MyTxt1";<br />
        TextBox MyTxt2 = new TextBox();<br />
        MyTxt2.ID = "MyTxt2";<br />
        DropDownList MyDDL1 = new DropDownList();<br />
        MyDDL1.ID = "MyDDL1";<br />
        MyDDL1.Items.Add(new ListItem("1", "1"));<br />
        MyDDL1.Items.Add(new ListItem("2", "2"));<br />
        DropDownList MyDDL2 = new DropDownList();<br />
        MyDDL2.ID = "MyDDL2";<br />
        MyDDL2.Items.Add(new ListItem("1", "1"));<br />
        MyDDL2.Items.Add(new ListItem("2", "2"));<br />
<br />
        PL.Controls.Add(MyTxt1);<br />
        PL.Controls.Add(MyTxt2);<br />
        PL.Controls.Add(MyDDL1);<br />
        PL.Controls.Add(MyDDL2);<br />
        <br />
    }<br />
    protected void MyButton_Click(object sender, EventArgs e)<br />
    {<br />
        string myText1 = ((TextBox)this.Page.FindControl("MyTxt1")).Text;<br />
        string myText2 = ((TextBox)this.Page.FindControl("MyTxt2")).Text;<br />
        string myDDL1 = ((DropDownList)this.Page.FindControl("MyDDL1")).SelectedValue;<br />
        string myDDL2 = ((DropDownList)this.Page.FindControl("MyDDL2")).SelectedValue;<br />
        Response.Write("Value 1 : " + myText1 + "<br />Value 2: " + myText2 + "<br />Value 3 :" + myDDL1 + "<br />Value 4: " + myDDL2);<br />
    }


please don't forget to vote on the post that helped you.

GeneralRe: Working with dynamically created controls Pin
Paul Conrad31-Dec-07 5:56
professionalPaul Conrad31-Dec-07 5:56 
Questionhow to retrive image from database change automatically into time interval Pin
ramesh_imayam30-Dec-07 18:53
ramesh_imayam30-Dec-07 18:53 
AnswerRe: how to retrive image from database change automatically into time interval Pin
Paul Conrad30-Dec-07 18:59
professionalPaul Conrad30-Dec-07 18:59 
GeneralWeird issue with nested datagrid Pin
N a v a n e e t h30-Dec-07 18:52
N a v a n e e t h30-Dec-07 18:52 
GeneralRe: Weird issue with nested datagrid Pin
Michael Sync30-Dec-07 19:44
Michael Sync30-Dec-07 19:44 
GeneralRe: Weird issue with nested datagrid Pin
Michael Sync30-Dec-07 19:48
Michael Sync30-Dec-07 19:48 
GeneralRe: Weird issue with nested datagrid Pin
N a v a n e e t h30-Dec-07 19:56
N a v a n e e t h30-Dec-07 19:56 
GeneralRe: Weird issue with nested datagrid Pin
Michael Sync30-Dec-07 20:02
Michael Sync30-Dec-07 20:02 
GeneralRe: Weird issue with nested datagrid Pin
N a v a n e e t h30-Dec-07 20:12
N a v a n e e t h30-Dec-07 20:12 
GeneralRe: Weird issue with nested datagrid Pin
Michael Sync30-Dec-07 20:19
Michael Sync30-Dec-07 20:19 
GeneralRe: Weird issue with nested datagrid Pin
N a v a n e e t h30-Dec-07 20:20
N a v a n e e t h30-Dec-07 20:20 
GeneralRe: Weird issue with nested datagrid Pin
Michael Sync30-Dec-07 20:24
Michael Sync30-Dec-07 20:24 
GeneralRe: Weird issue with nested datagrid Pin
Vasudevan Deepak Kumar2-Jan-08 20:11
Vasudevan Deepak Kumar2-Jan-08 20:11 
Questionhow to increase the speed of an application Pin
jagan12330-Dec-07 18:21
jagan12330-Dec-07 18:21 
AnswerRe: how to increase the speed of an application Pin
Michael Sync30-Dec-07 18:33
Michael Sync30-Dec-07 18:33 
AnswerRe: how to increase the speed of an application Pin
Paul Conrad30-Dec-07 19:02
professionalPaul Conrad30-Dec-07 19:02 
GeneralRe: how to increase the speed of an application Pin
jagan12330-Dec-07 19:07
jagan12330-Dec-07 19:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.