This is a migrated thread and some comments may be shown as answers.

toggle visibility of server control

2 Answers 119 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Wolfgang Sigel
Top achievements
Rank 1
Wolfgang Sigel asked on 23 Jun 2010, 01:36 PM
Hi, I have a problem with a LinkButton which is initially not visible (-> set during Page_Load). The LinkButton is contained among with a few other controls in an ASP:Panel (see code):

<asp:Panel ID="pnlLogin" runat="server">                        
<asp:LoginName ID="loginName" runat="server" FormatString="Welcome {0}" />
<asp:LinkButton ID="btnUpdateProfile" runat="server" CssClass="login" Text="My Profile"></asp:LinkButton>                                       
<asp:LinkButton ID="btnLoginMain" runat="server" CssClass="login">Log In</asp:LinkButton>
<asp:LinkButton ID="btnCreateLogin" runat="server" CssClass="login">Register</asp:LinkButton>
</asp:Panel>    

After evaluating an ajax_request event on the server the visibility of the LinkButton is set to true if a certain condition is met.
At first sight everything seems alright, the previous hidden control is now displayed. However if one takes a look at the rendered
segment the link-quality is gone:

<div id="pnlLoginPanel">
<div id="pnlLogin">
<a id="btnLoginMain" class="login" href="javascript:__doPostBack('btnLoginMain','')">Log In</a>                    
<a id="btnCreateLogin" class="login" href="javascript:__doPostBack('btnCreateLogin','')">Register</a>
</div>
</div>         

This is quite unfortunate since this LinkButton should now function as OpenerElementID of a RadWindow - which it can't do any
more. Can anybody point out to me, what is going wrong ?

Thanks a lot,
Wolfgang

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 28 Jun 2010, 09:52 AM
Hi Wolfgang,

The OpenerElementID / OffsetElementID use the page's databinding mechanism and that is why we do not recommend using it in more complex scenarios, especially when Ajax is involved. In your case I suggest not to use OpenerElementID but the OnClientClick property of the link button and to set a name of a JavaScript function there that would open the RadWindow. (OnClientClick="openWin(); return false;").


Greetings,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Wolfgang Sigel
Top achievements
Rank 1
answered on 29 Jun 2010, 07:17 AM
Hi Georgi,
thanks for your feedback. In the meanwhile I've got it working. The problem was that I didn't include the RadWindow in the in the UpdatedControls section of the RadAjaxManager. SInce the OpenerElementID didn't change I didn't imagine there was a need to include the RadWindow for an update. However - if my solution runs into trouble I'll be happy to have your suggestion as a backup.

Thanks, Wolfgang
Tags
General Discussions
Asked by
Wolfgang Sigel
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Wolfgang Sigel
Top achievements
Rank 1
Share this question
or