Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > ASP.NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-26-2007, 04:31 PM
.NetDoubts .NetDoubts is offline
Registered User
 
Join Date: Dec 2006
Posts: 16
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
Reply With Quote
  #2  
Old 10-31-2009, 07:59 PM
Bencho Bencho is offline
Registered User
 
Join Date: Oct 2009
Posts: 1
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>
<div id='myDiv'>
<asp:TextBox ID="myTextBox" runat="server"/>
</div>
</ContentTemplate>
</asp:UpdatePanel>

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();
}
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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


All times are GMT -4. The time now is 11:46 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.