H
Hai Nguyen
Hi all
I created a user control called temp1.ascx which contains several textboxes
and a button. I also have a webform name Web1.aspx.
In the web form Web1.ascx, I have this code
if(!this.IsPostBack)
{
PlaceHolder1.Controls.Add(this.LoadControl("temp1.ascx"));
}
else
{
}
In the web form temp1.ascx, I have this code
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
}
else
{
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
Session[0] = txtKeyWord.Text;
Session[0] = txtURL.Text;
}
Here are my questions:
1/ Why does my usercontrol disappear after I hit the submit button? Do I
have to Load the control during the postback?
2/ How should I pesist my value entered on both the webform and usercontrol
Please provide me any examples with UserControls, article
Thanks
I created a user control called temp1.ascx which contains several textboxes
and a button. I also have a webform name Web1.aspx.
In the web form Web1.ascx, I have this code
if(!this.IsPostBack)
{
PlaceHolder1.Controls.Add(this.LoadControl("temp1.ascx"));
}
else
{
}
In the web form temp1.ascx, I have this code
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
}
else
{
}
}
private void Button2_Click(object sender, System.EventArgs e)
{
Session[0] = txtKeyWord.Text;
Session[0] = txtURL.Text;
}
Here are my questions:
1/ Why does my usercontrol disappear after I hit the submit button? Do I
have to Load the control during the postback?
2/ How should I pesist my value entered on both the webform and usercontrol
Please provide me any examples with UserControls, article
Thanks