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

OnClientHiding Postback

2 Answers 53 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Storm
Top achievements
Rank 1
Storm asked on 12 Feb 2012, 01:06 AM
I would like to do a postback with onClientHiding.... It seems that onClientHiding does fire but the postback is not..

   function OnClientHiding(sender, args) {
        __doPostBack('<%=btnCloseMessage.ClientID %>', 'OnClick');
    }
 
<asp:UpdatePanel ID="Message" runat="server" ChildrenAsTriggers="True" UpdateMode="Conditional"
    Visible="True">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnCloseMessage" EventName="Click" />
    </Triggers>
    <ContentTemplate>
        <div style="visibility: hidden; height: 1px; width: 1px; overflow: hidden">
            <telerik:RadButton ID="btnCloseMessage" runat="server" OnClick="btnCloseMessage_Click" CausesValidation="False">
            </telerik:RadButton>
        </div>
        <telerik:RadNotification ID="RadNotification1" runat="server" Skin="Black" AutoCloseDelay="0"
            VisibleOnPageLoad="False" Width="300" Animation="Fade" EnableRoundedCorners="true"
            OnClientHiding="OnClientHiding" EnableShadow="true" Title="Breaking News" OffsetX="-20"
            OffsetY="-20">
            <ContentTemplate>
                <asp:Literal ID="litMessage" runat="server"></asp:Literal>
            </ContentTemplate>
        </telerik:RadNotification>
        <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick">
        </asp:Timer>
    </ContentTemplate>
</asp:UpdatePanel>

2 Answers, 1 is accepted

Sort by
0
Storm
Top achievements
Rank 1
answered on 12 Feb 2012, 02:25 PM
changing from

__doPostBack(

 

'<%=btnCloseMessage.ClientID %>', '');


To

__doPostBack(

 

'<%=btnCloseMessage.UniqueID %>', '');

Worked

0
Svetlina Anati
Telerik team
answered on 13 Feb 2012, 12:29 PM
Hello Storm,

Indeed, you have correctly noticed that the call should be done with the UniqueID. In simple scenarios when no INaming Containers are used, ClientID or even simply the ID will work, while when calling it when in INaming Container you should provide the UniqueID so that your control can be recognized as the eventTarget. There is some confusing information on the net regarding that (e.g some say that it depends on the browser what ID to use) but the difference is in the INaming Containers presence on the resultant page and I can assure you that the solution you have found is a reliable one. 

Regards,
Svetlina Anati
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Notification
Asked by
Storm
Top achievements
Rank 1
Answers by
Storm
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or