|
#1
|
|||
|
|||
|
UpdatePanel + Control Visibility
Hello All,
I have a updatepanel(AJAX) in my aspx page. This updatepanel has 2 dropdownlists, 2 textboxes and a button. Depending on the value selected in first dropdownlist I am toggling the visibility of other controls. The problem is when first dropdown causes a postback and even though I set the visible=true for second dropdown, I donot find the corresponding html in view source. Because of this I cannot set focus to the second dropdownlist through javascript when the button is clicked. When the button is clicked I use window.open to do some processing in another(child) page, in this page(child) after the processing, I set focus to the next visible control (in parent page) after the button. There is no postback for the button. Any help will be appreciated. Thank You |
|
#2
|
|||
|
|||
|
a work-around
Faced the same problem ... seems when you toggle visibility of controls within an UpdatePanel, the server-side generated markup doesn't include said controls.
Scoured the net for a solution to no avail ![]() Managed a work-around : Contain the controls of which you wish to toggle the visible state within a <div id='xxxxxxx'> tag. Markup: <asp:UpdatePanel ID="myUpdatePanel" runat="server" > <ContentTemplate></asp:UpdatePanel><div id='myDiv'><asp:TextBox ID="myTextBox" runat="server"/></div></ContentTemplate> Code-Behind : void Button_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "myScriptID", GetToggleVisibiltyScript(), true);} private string GetToggleVisibiltyScript() { StringBuilder script = new StringBuilder(); script.Append(String.Format("document.getElementById('myDiv').innerHTML = '<input type=\"text\" id=\"{0}\" />';", this.myTextBox.ClientID)); return script.ToString();} |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Issue with UpdatePanel and ProgressPanel nested in a composite control | lior3790 | AJAX | 0 | 10-23-2006 07:32 AM |
| Re: A moderate view - Adressing Control Arrays..... | Paul Mc | .NET | 15 | 05-09-2001 05:40 AM |
| WEIRD ActiveX control problem | Glenn | ASP.NET | 0 | 12-13-2000 08:55 AM |
| ActiveX Control Visibility | Vini | VB Classic | 3 | 05-27-2000 07:26 PM |
| ActiveX Control Visibility | Vini | VB Classic | 0 | 05-22-2000 02:15 AM |