Tags: adding, ajax, asp, aspnet, container, control, controls, dynamically, net, page, panel, runtime, updatepanel, vs2005, web
Adding a control to an UpdatePanel at runtime
I have a web page (asp.net 2.0, vs2005) in which I add controls dynamically to a Panel control.
Now I changed the container in an UpdatePanel.
Usually I simply add a newly created control with a statement like this:
With UpdatePanel do I need to do anything else ?
I asked because my control doesn't get updated correctly.
I tried adding a line
but with no sucess..
Does anyone have any tips/suggestions/advices ?
Thanks in advance
Leave a comment...
- 4 Comments
- Try out this Button btnButton =newButton();btnButton.Text="New Button";
my page orginally has this
<asp:UpdatePanelID="UpdatePanel1"runat="server"><ContentTemplate><asp:ButtonID="Button1"runat="server"OnClick="Button1_Click"Text="Button"/></ContentTemplate></asp:UpdatePanel>#1; Sun, 06 Jan 2008 08:45:00 GMT
I tried but it doesn't work (thanks anyway for answering!)
To clarify my problem: in the page_load I write the text inside the dynamically added control.
Something like this:
Textbox MyT = new Textbox();
MyT.Text = "test string";
In the debugger I see the new value, but it doesn't get updated in the web page.#2; Sun, 06 Jan 2008 08:46:00 GMT
As a Final Statemet of update call this
UpdatePanel1.Update();#3; Sun, 06 Jan 2008 08:47:00 GMT
I tried but it doesn't work neither.
I eventually find out that the problem could depend on the third-parties server controls that I am using.
Thanks anyway for answering
Nicola#4; Sun, 06 Jan 2008 08:48:00 GMT