You must Sign In to post a response.
  • Category: ASP.NET

    Why not jquery working in Asp.net

    hi,

    I am trying to validate for asp.net control. it is accepted first validition and remaining
    is bot doing validation. only checking tbNextCallDate and remaining is not checking. I am
    using bootstrap modal. I am getting 'Do you want Continue' double message.


    <script type="text/javascript">
    function LoadAjaxControls() {
    $(document).ready(function () {
    $('#<%=bSaveHistory.ClientID%>').on('click', function (e) {
    var flag = true;

    var selectEngMar = $("#<%= rblLanguage.ClientID %> input:checked").val();

    if ($('#<%=ddlHistoryStatus.ClientID%>').val() != "4" && $('#<%=ddlHistoryStage.ClientID%>').val() != "9") {
    if ($('#<%=tbNextCallDate.ClientID%>').val() == "") {
    alert('Please Enter Next Call Date');
    $('#<%=tbNextCallDate.ClientID%>').focus();
    flag = false;
    }
    }
    else if ($('#<%=ddlHistoryStatus.ClientID%>').val() == "0") {
    alert('Please Select Status');
    $('#<%=ddlHistoryStatus.ClientID%>').focus();
    flag = false;
    }
    else if ($('#<%=ddlHistoryStage.ClientID%>').val() == "0") {
    alert('Please Select Stage');
    $('#<%=ddlHistoryStage.ClientID%>').focus();
    flag = false;
    }
    else if (!isNaN(selectEngMar)) {
    if (selectEngMar == 0) {
    if ($('#<%=tbCommentEng.ClientID%>').val() == "") {
    alert("Please Enter English Comment");
    $('#<%=tbCommentEng.ClientID%>').focus();
    flag = false;
    }
    }
    else if (selectEngMar == 1) {
    if ($('#<%=tbCommentMar.ClientID%>').val() == "") {
    alert("Please Enter Marathi Comment");
    $('#<%=tbCommentMar.ClientID%>').focus();
    flag = false;
    }
    }
    }

    if (flag == false) {
    e.preventDefault();
    return false;
    }
    else if (flag == true) {
    if (confirm("Do you want Continue..?") == true) {
    return true;
    }
    else {
    return false;
    }
    }
    });
    });
    }

    function UpdateAjaxJQuery() {
    if (typeof (Sys) != 'undefined') {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(function () {
    LoadAjaxControls();
    });
    }
    }

    $(document).ready(function () {
    UpdateAjaxJQuery();
    LoadAjaxControls();
    });
    </script>



    <div id="dMPreviousHistory" class="modal fade" data-backdrop="static" data-keyboard="false"
    role="dialog">
    <asp:UpdatePanel ID="upPrvHistory" runat="server">
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="bSaveHistory" EventName="Click" />
    <asp:PostBackTrigger ControlID="rblLanguage" />
    </Triggers>
    <ContentTemplate>
    <div class="modal-dialog" style="width: 80%;">
    <div class="modal-content">
    <div class="modal-header">
    <asp:Button ID="bclose2" runat="server" Style="float: right; color: White; font-weight: bold;"
    data-dismiss="modal" OnClick="bclose2_Click" Text="x" class="btn btn-sm btn-info" />
    <h4 class="modal-title">
        </h4>
    </div>
    <div class="modal-body" style="max-height: 10%; max-width: 80%; margin-top: 05px;
    margin-bottom: 05px; text-align: left;">
    <div class="row">
    <div class="col-md-6" id="dHistory" runat="server" style="width: 125%; margin-left: 05px;
    display: none;">
    <div class="panel panel-primary">
    <div class="panel-heading">
    <h3 class="panel-title">
    Activity History</h3>
    </div>
    <div style="height: 200px; overflow: auto;" id="Panel1">
    <asp:DataGrid ID="dgPreviousHistory" Width="1015px" runat="server" CssClass="table table-hover table-bordered table-striped"
    BackColor="White" ForeColor="Black" BorderStyle="Groove" Font-Size="12px" AutoGenerateColumns="false">
    <HeaderStyle CssClass="pageheading" HorizontalAlign="Center" BackColor="#293339"
    Font-Bold="True" ForeColor="White" Width="10%" />
    <Columns>
    <asp:TemplateColumn HeaderText="Sr.No." ItemStyle-Width="10px">
    <ItemTemplate>
    <%# Container.ItemIndex+1%>
    </ItemTemplate>
    </asp:TemplateColumn>
    <asp:BoundColumn DataField="FARMER_ID" Visible="false" />
    <asp:BoundColumn DataField="COMMENT" HeaderText="Comment" ItemStyle-Width="300px" />
    <asp:BoundColumn DataField="NEXT_CALL_DATE" HeaderText="Next Call Date" ItemStyle-HorizontalAlign="Center"
    ItemStyle-Width="150px" />
    <asp:BoundColumn DataField="PRIORITY" HeaderText="Priority" ItemStyle-Width="50px" />
    <asp:BoundColumn DataField="STATUS" HeaderText="Status" ItemStyle-Width="200px" />
    <asp:BoundColumn DataField="STAGE" HeaderText="Stage" ItemStyle-Width="200px" />
    <asp:BoundColumn DataField="MODIFIED_BY" HeaderText="Updated By" ItemStyle-Width="100px" />
    <asp:BoundColumn DataField="LAST_MODIFIED" HeaderText="Date of Comment" ItemStyle-Width="150px" />
    </Columns>
    </asp:DataGrid>
    </div>
    </div>
    </div>
    </div>
    <br />
    <div class="row" style="margin-left: 250px;">
    <div class="row" runat="server">
    <div class="col-sm-7 form-group">
    <b>Language</b>
    <asp:RadioButtonList ID="rblLanguage" runat="server" RepeatDirection="Horizontal"
    CellPadding="20" onclick="EnableEnglishMarathi()">
    <asp:ListItem Value="0" Selected="True">English   </asp:ListItem>
    <asp:ListItem Value="1">?????</asp:ListItem>
    </asp:RadioButtonList>
    </div>
    </div>
    <div class="row" runat="server">
    <div id="dEnglish" runat="server" class="col-sm-7 form-group" style="display: block;">
    <b>English Comments</b>
    <asp:TextBox ID="tbCommentEng" TextMode="MultiLine" Width="500px" Rows="5" runat="server"
    placeholder="Enter Comments.." class="form-control"></asp:TextBox>
    </div>
    <div id="dMarathi" runat="server" class="col-sm-7 form-group" style="display: none;">
    <b>Marathi Comments</b>
    <asp:TextBox ID="tbCommentMar" TextMode="MultiLine" Width="500px" Rows="5" runat="server"
    placeholder="Enter Comments.." class="form-control"></asp:TextBox>
    </div>
    </div>
    <div id="Div2" class="row" runat="server">
    <div class="col-sm-4 form-group">
    <b>Next Call Date</b>
    <asp:TextBox ID="tbNextCallDate" Width="120px" runat="server" placeholder="Enter Next Call Date.."
    class="form-control"></asp:TextBox>
    <asp:Image ID="ibNextCallDate" runat="server" ImageUrl="~/Image/Calendar.png" Height="24px"
    Width="24px" Style="margin-left: 125px; margin-top: -30px;" />
    <asp:CalendarExtender ID="ceNextCallDate" CssClass="cal_Theme1" runat="server" Format="dd-MM-yyyy"
    TargetControlID="tbNextCallDate" PopupButtonID="ibNextCallDate">
    </asp:CalendarExtender>
    </div>
    <div class="col-sm-3 form-group">
    <b>Priority</b>
    <asp:DropDownList ID="ddlPriority" runat="server" class="form-control">
    <asp:ListItem Selected="True" Value="1">Low</asp:ListItem>
    <asp:ListItem Value="2">Moderate</asp:ListItem>
    <asp:ListItem Value="3">High</asp:ListItem>
    </asp:DropDownList>
    </div>
    </div>
    <div class="row" style="text-align: left;">
    <div class="col-sm-5 form-group">
    <b>Status</b>
    <asp:DropDownList ID="ddlHistoryStatus" runat="server" class="form-control">
    </asp:DropDownList>
    </div>
    <div class="col-sm-5 form-group">
    <b>Stage</b>
    <asp:DropDownList ID="ddlHistoryStage" runat="server" class="form-control">
    </asp:DropDownList>
    </div>
    </div>
    </div>
    <div>
    <asp:Button ID="bSaveHistory" runat="server" class="btn btn-md btn-info" Text="Save"
    OnClick="bSaveHistory_Click" Style="margin-left: 500px;" />
    </div>
    </div>
    <div class="well">
    <asp:Button ID="bCancel" runat="server" class="btn btn-md btn-info" data-dismiss="modal"
    Text="Close" OnClick="bCancel_Click" Style="float: right; margin-top: -17px;" />
    </div>
    </div>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
    </div>
  • #767564
    Hi,

    Could you please provide more details, so that we can help you better, more over while posting question please don't post your full code, describe your content clearly and post piece of code which you really had a problem.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/


Sign In to post your comments