locked
APPLY THIS CODE RRS feed

  • Question

  • User-807418713 posted

    HELLO

    HOW TO APPLY THIS CODE

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function EndRequestHandler(sender, args) {

    FOR THIS CODE

    <script>
            $(function () {
                 $(".dd").datepicker({
                    dateFormat: "dd-M-yy",
                    minDate: new Date('2017/11/01'),
                    changeYear: true,
                    changeMonth:true,
                    yearRange: '2017:2022',
                                  
            });
            });
    </script>

    tHANKINF YOU

    Thursday, January 7, 2021 12:31 PM

Answers

  • User1535942433 posted

    Hi Gopi.MCA,

    Do you know more about Sys.WebForms.PageRequestManager Class? It manages partial-page updates of server UpdatePanel controls in the browser, and defines properties, events, and methods that can be used to customize a Web page by using client script.

    The endRequest event is raised after an asynchronous postback is finished and control has been returned to the browser. You could use this event to provide a notification to users or to log errors.

    If you need to show the datapicker,you could use  the pageLoaded event.

    Just like this:

     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.min.js" type="text/javascript"></script>
        <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js" type="text/javascript"></script>
        <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jquery-ui.css"
            rel="Stylesheet" type="text/css" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js" type="text/javascript"></script>
        <script>
            $(function () {
                Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(picker);
                function picker() {
                    $("#dd").datepicker({
                        dateFormat: "dd-M-yy",
                        minDate: new Date('2017/11/01'),
                        changeYear: true,
                        changeMonth: true,
                        yearRange: '2017:2022',
                    });
                }
            })
        </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <div class="form-group row">
                        <div class="col-sm-12">
                            <asp:TextBox ID="dd" class="form-control" runat="server"></asp:TextBox>
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>

    More details,you could refer to below article:

    https://docs.microsoft.com/en-us/previous-versions/bb311028(v=vs.100)?redirectedfrom=MSDN

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 8, 2021 2:56 AM

All replies

  • User-1545767719 posted

    Can you describe the poupose of the code  (i.e, what dou want to do with the code) in detail? 

    Thursday, January 7, 2021 10:04 PM
  • User1535942433 posted

    Hi Gopi.MCA,

    Do you know more about Sys.WebForms.PageRequestManager Class? It manages partial-page updates of server UpdatePanel controls in the browser, and defines properties, events, and methods that can be used to customize a Web page by using client script.

    The endRequest event is raised after an asynchronous postback is finished and control has been returned to the browser. You could use this event to provide a notification to users or to log errors.

    If you need to show the datapicker,you could use  the pageLoaded event.

    Just like this:

     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.0.min.js" type="text/javascript"></script>
        <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/jquery-ui.min.js" type="text/javascript"></script>
        <link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.9.2/themes/blitzer/jquery-ui.css"
            rel="Stylesheet" type="text/css" />
        <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js" type="text/javascript"></script>
        <script>
            $(function () {
                Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(picker);
                function picker() {
                    $("#dd").datepicker({
                        dateFormat: "dd-M-yy",
                        minDate: new Date('2017/11/01'),
                        changeYear: true,
                        changeMonth: true,
                        yearRange: '2017:2022',
                    });
                }
            })
        </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <div class="form-group row">
                        <div class="col-sm-12">
                            <asp:TextBox ID="dd" class="form-control" runat="server"></asp:TextBox>
                        </div>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>

    More details,you could refer to below article:

    https://docs.microsoft.com/en-us/previous-versions/bb311028(v=vs.100)?redirectedfrom=MSDN

    Best regards,

    Yijing Sun

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, January 8, 2021 2:56 AM