DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: UpdatePanel + Control Visibility

  1. #1
    Join Date
    Dec 2006

    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 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. #2
    Join Date
    Oct 2009

    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.


    <asp:UpdatePanel ID="myUpdatePanel" runat="server" >
    <div id='myDiv'>
    <asp:TextBox ID="myTextBox" runat="server"/>

    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();

Similar Threads

  1. Replies: 0
    Last Post: 10-23-2006, 06:32 AM
  2. Replies: 15
    Last Post: 05-09-2001, 04:40 AM
  3. WEIRD ActiveX control problem
    By Glenn in forum ASP.NET
    Replies: 0
    Last Post: 12-13-2000, 08:55 AM
  4. ActiveX Control Visibility
    By Vini in forum VB Classic
    Replies: 3
    Last Post: 05-27-2000, 06:26 PM
  5. ActiveX Control Visibility
    By Vini in forum VB Classic
    Replies: 0
    Last Post: 05-22-2000, 01:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center