OnClientHiding Postback

3 posts, 0 answers
  1. Storm
    Storm avatar
    7 posts
    Member since:
    Jan 2011

    Posted 11 Feb 2012 Link to this post

    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. Storm
    Storm avatar
    7 posts
    Member since:
    Jan 2011

    Posted 12 Feb 2012 Link to this post

    changing from

    __doPostBack(

     

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


    To

    __doPostBack(

     

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

    Worked

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 13 Feb 2012 Link to this post

    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 >>
Back to Top