Click here to Skip to main content
15,921,716 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to Dispaly Records on runtime. Pin
lbothell20-Mar-08 8:14
lbothell20-Mar-08 8:14 
GeneralLDAP with ASP.net Pin
v1i9n6o7d18-Mar-08 3:05
v1i9n6o7d18-Mar-08 3:05 
Generalradio button default selection Pin
Sandeep Akhare18-Mar-08 2:10
Sandeep Akhare18-Mar-08 2:10 
GeneralRe: radio button default selection Pin
danasegaranea18-Mar-08 2:13
danasegaranea18-Mar-08 2:13 
GeneralRe: radio button default selection Pin
Sandeep Akhare18-Mar-08 2:29
Sandeep Akhare18-Mar-08 2:29 
GeneralRe: radio button default selection Pin
EvilInside18-Mar-08 2:15
EvilInside18-Mar-08 2:15 
GeneralRe: radio button default selection Pin
Sandeep Akhare18-Mar-08 2:32
Sandeep Akhare18-Mar-08 2:32 
GeneralValues from Textbox Pin
danasegaranea18-Mar-08 2:07
danasegaranea18-Mar-08 2:07 
Hi all,
I am using this code to create textbox in asp.net pages and adding it to the panel control

Page load Event
TextBox txtbox;
           for (int i = 1; i < 10; i++)
           {
               txtbox = new TextBox();
               txtbox.ID = "mytextbox" + i;
               txtbox.AutoPostBack = false;
               Panel1.Controls.Add(txtbox);
           }


ViewSource

<div id="Panel1"><br />
	<br />
        <input name="mytextbox1" type="text" id="mytextbox1" /><input name="mytextbox2" type="text" id="mytextbox2" /><input name="mytextbox3" type="text" id="mytextbox3" /><input name="mytextbox4" type="text" id="mytextbox4" /><input name="mytextbox5" type="text" id="mytextbox5" /><input name="mytextbox6" type="text" id="mytextbox6" /><input name="mytextbox7" type="text" id="mytextbox7" /><input name="mytextbox8" type="text" id="mytextbox8" /><input name="mytextbox9" type="text" id="mytextbox9" /><br />
</div>




and want to retrive the textbox values in a button click event. But it not iterarting throgh the textbox collection

protected void Button2_Click(object sender, EventArgs e)
    {

        IterateThroughChildren(this);
    }

    void IterateThroughChildren(Control parent)
    {
        foreach (Control c in parent.Controls)
        {
            if (c.GetType().ToString().Equals("System.Web.UI.WebControls.TextBox")
                  && c.ID == null)
            {
                TextBox txtbox = (TextBox)c;
            }

            if (c.Controls.Count > 0)
            {
                IterateThroughChildren(c);
            }
        }
    }


Thanks in Advance
GeneralRe: Values from Textbox Pin
Not Active18-Mar-08 2:42
mentorNot Active18-Mar-08 2:42 
GeneralRe: Values from Textbox Pin
danasegaranea18-Mar-08 2:51
danasegaranea18-Mar-08 2:51 
GeneralRe: Values from Textbox Pin
Not Active18-Mar-08 3:16
mentorNot Active18-Mar-08 3:16 
GeneralRe: Values from Textbox Pin
danasegaranea18-Mar-08 20:15
danasegaranea18-Mar-08 20:15 
QuestionHow do i 'create a folder programmatically' ? Pin
munklefish18-Mar-08 2:01
munklefish18-Mar-08 2:01 
GeneralRe: How do i 'create a folder programmatically' ? Pin
eyeseetee18-Mar-08 4:04
eyeseetee18-Mar-08 4:04 
GeneralRe: How do i 'create a folder programmatically' ? Pin
munklefish18-Mar-08 4:23
munklefish18-Mar-08 4:23 
QuestionConfiguration Problem Pin
EvilInside18-Mar-08 1:51
EvilInside18-Mar-08 1:51 
GeneralRe: Configuration Problem Pin
Paul Conrad21-Mar-08 9:23
professionalPaul Conrad21-Mar-08 9:23 
QuestionHow to rotate div(text) with the use of javascript Pin
Trishul Tandel18-Mar-08 1:40
Trishul Tandel18-Mar-08 1:40 
AnswerRe: How to rotate div(text) with the use of javascript Pin
Mark J. Miller18-Mar-08 5:10
Mark J. Miller18-Mar-08 5:10 
GeneralRender the Datatable data into the Table Html Format Pin
Aavesh Agarwal18-Mar-08 1:04
Aavesh Agarwal18-Mar-08 1:04 
GeneralRe: Render the Datatable data into the Table Html Format Pin
Trishul Tandel18-Mar-08 1:17
Trishul Tandel18-Mar-08 1:17 
GeneralReading .mpp file.. (Interesting) Pin
rain raj18-Mar-08 0:55
rain raj18-Mar-08 0:55 
GeneralImage not displaying Pin
.NET- India 18-Mar-08 0:45
.NET- India 18-Mar-08 0:45 
GeneralRe: Image not displaying Pin
Chetan Patel18-Mar-08 1:06
Chetan Patel18-Mar-08 1:06 
GeneralRe: Image not displaying Pin
.NET- India 18-Mar-08 1:27
.NET- India 18-Mar-08 1:27 

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.