here is a sample.  Basically you need to know what the id is and then 
use FindControls to get the object.

public class WebForm1 : System.Web.UI.Page
{
   protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1;
   protected System.Web.UI.WebControls.Button Button1;
        
private void Page_Load(object sender, System.EventArgs e)
{
     TextBox t = null;
     for (int i=0;i<5;i++){
        
        t=new TextBox();
        t.ID = "txt"+i;
        PlaceHolder1.Controls.Add(t);
      }
}


private void Button1_Click(object sender, System.EventArgs e)
{
        for (int i=0;i<5;i++)
        {
        Response.Write(((TextBox)this.FindControl("txt"+i)).Text);
        }
}




--- In [EMAIL PROTECTED], meghanad chitre 
<[EMAIL PROTECTED]> wrote:
> hi all,
> 
> I am creating few text boxes in  Page_Load event of a
> webpage.
> Now a user can keyin the values in those dynamically
> created controls.
> On a click of a button (this is not dynamically
> created) i need to access all those 
> controls which were dynamically created (i can trace
> those with fixname + variable name approach)
> 
> But when i try this
> all the time the concerned control is not found and
> error is thrown.
> I know that this is happening due to Post Back.
> i.e. the dynamically created controls are wiped off
> since its a postback.
> 
> how can this problem be handled ?
> please guide,
> best regards,
> --meghanad
> 
> 
> 
> 
>       
>               
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains � Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
---------------------------------------------------------------------~->

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
     [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 

Reply via email to