i never send a post without trying it locally on my PC. As long as it works, why do you care which one is rendered first? if you really wonder it, just put a break point to load event handlers of both usercontrol and webform.
no this example does not use ajax.
My question whether the parent.findcontrol was the way to go, and it seems that way. I'm not talking about the code exactly. That I was given this fine example of usage I thanks alot, but I did not expect such fine an example.
My question on which is rendered first wasn't a real question but more a comment on the main page is rendered first which mean that the control referered to is not changed without changing the main site which is already rendered and lead to another postback. Understand my point.
The exact question is that i need ajax to render the main page when the usercontrol is making a postback, but how is this done without flickering/postback all the page.
To update the textfield (main site) for example I need to surround this by an updatepanel and then the textbox-control can be updated without flicker, but how do I ensure that the usercontrol's runat server command to update the updatepanel is not updating the usercontrol as well and make postback on this as well? should I surround all the usercontrol-controls with an updatepanel?
I don't know if I am clear in my question. If not let me know.
CODE MAIN SITE:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Literal ID="LiteralMessages" runat="server"></asp:Literal>
<br />
<uc1:WebUserControl ID="WebUserControl1" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
CODE UC:
protected void cb_enabled_CheckedChanged(object sender, EventArgs e)
{
...
((Literal)Parent.FindControl("LiteralMessages")).Text += Msg.PrintMessages(MYDLL.GetMessages(Request, Session));
...
}
<asp:Label ID="lblName" runat="server" Width="150px"></asp:Label>
<asp:CheckBox ID="cb_enabled" runat="server"
oncheckedchanged="cb_enabled_CheckedChanged" AutoPostBack="true" />
What I want is that the checkbox when changed sends a message back to the main site and not postback the entire site so it flickers.