|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: |
EXAMPLE:
I have created a very simple example to illistrate this.
In this example, when the button on the page is pressed once, it loads the
user control and the events of the user control work fine. If, however, the
page button is pressed again, the control is reloaded into the placeholder
but the user control events are lost on the first click of an event firing
control (button in this example). After the first click on the user control
button, the control buttons events start working again.
I am using this in a much more complex senerio and need to find out what I
am doing wrong.
Thank you for your help
Earl
USER CONTROL:
The user control consists of one button and a literal and the botton event
is:
private void Button1_Click(object sender, System.EventArgs e)
{
Literal1.Text="Hello World";
}
ASPX PAGE THAT LOADS CONTROL
The loading page consists of a placeholder control and a button with the
following property and event handlers
private void Page_Load(object sender, System.EventArgs e)
{
if (ControlLoaded)
LoadUserControl();
}
private void Button1_Click(object sender, System.EventArgs e)
{
LoadUserControl();
}
private void LoadUserControl()
{
PlaceHolder2.Controls.Clear();
PlaceHolder2.Controls.Add(Page.LoadControl("~/test/DynamicLoadUserCont.ascx"
));
ControlLoaded=true;
}
public bool ControlLoaded
{
get
{
Object s = ViewState["ControlLoaded"];
return ((s==null)?falsebool)s);
}
set
{
ViewState["ControlLoaded"] = value;
}
}
|
Advertisement
| Hall of Fame |