相关文章推荐
绅士的洋葱  ·  cornerstone Tools ...·  2 年前    · 
宽容的毛衣  ·  Selenium Python ...·  2 年前    · 
爱旅游的感冒药  ·  not found cptable in ...·  2 年前    · 

Friends,

I am using Aspx. VB tool for web apps development. following my code is works find and data is saved sucessfully, after this sucessfull message, Im getting a followin error. How to I fix this?

Uncaught TypeError: Cannot read properties of undefined (reading 'mData')

ref my JQuery script:

    $.ajax({  
                       type: "POST",  
                       url: "ICT_InsuranceDocumentationV3.aspx/PostImageDB",  
                       data: '{f_db: ' + JSON.stringify(f_db) + '}',  
                       contentType: "application/json; charset=utf-8",  
                       dataType: "json",  
                       success: function (response) {  
                           var result = response.d;  
                           if (result == '1') {  
                               alert("The Banking Statement/Passbook/Cheque information has been updated successfully!");  
                               $(".modal-backdrop").remove();  
                               $("#PopuBankDocUL").modal('show');  
                               $('#chkbox_IsScanDocUploaded').prop('checked');  
                               $('#btn_UploadBankDoc').prop("disabled", true);  
                               $('#btnImgsubmit').prop("disabled", true);  
                           else if (result == '2') {  
                               alert("The Banking Statement/Passbook/Cheque details are replaced with this new data!");  
                           else {  
                               alert("Sorry! There is an err. on Data Transmission, please contact IT Admin!");  
                       error: function (data, ex) {  
                           alert("Sorry there is err. " + data + " Ex: " + ex);  
                           $(".modal-backdrop").remove();  
                           $("#PopuBankDocUL").modal('show');  

My Backend VB Code

<WebMethod()> <ScriptMethod()>  
    Public Shared Function PostImageDB(f_db As f_db) As String  
        Dim DCStr As String = ConfigurationManager.ConnectionStrings("ICT_ConStr").ConnectionString  
        Dim selectSQL As String  
        Dim sCon As New SqlConnection(DCStr)  
        Dim sCmd As New SqlCommand(selectSQL, sCon)  
        Dim param As SqlParameter  
        Dim dtadp As New SqlDataAdapter(sCmd)  
        Dim dtset As New DataSet  
        Dim f_retval As String = ""  
            sCon.Open()  
            sCmd.CommandType = CommandType.StoredProcedure  
            sCmd.CommandText = "ICTUSP_BankDocumentUploads_Txn"  
            sCmd.Parameters.Clear()  
            sCmd.Parameters.Add(New SqlParameter("@i_SP_AttributeId", SqlDbType.Int)).Value = 1  
            sCmd.Parameters.Add(New SqlParameter("@i_ApplTrackingNo", SqlDbType.VarChar)).Value = f_db.trackingId  
            sCmd.Parameters.Add(New SqlParameter("@i_LoanId", SqlDbType.VarChar)).Value = f_db.LoanId  
            sCmd.Parameters.Add(New SqlParameter("@i_BankDocumentTypeID", SqlDbType.VarChar)).Value = f_db.doctypeId  
            sCmd.Parameters.Add(New SqlParameter("@i_BankDocumentProofPath", SqlDbType.VarChar)).Value = f_db.ulFileName  
            sCmd.Parameters.Add(New SqlParameter("@i_LastTxnDate", SqlDbType.VarChar)).Value = f_db.ftxndt  
            sCmd.Parameters.Add(New SqlParameter("@i_Remarks", SqlDbType.VarChar)).Value = f_db.remarks  
            param = New SqlParameter("@o_ErrorStatus", SqlDbType.Int) With {  
            .Direction = ParameterDirection.Output  
            sCmd.Parameters.Add(param)  
            dtadp.Fill(dtset)  
            If sCmd.Parameters("@o_ErrorStatus").Value = 1 Then  
                f_retval = "1"  
            ElseIf sCmd.Parameters("@o_ErrorStatus").Value = 2 Then  
                f_retval = "2"  
            End If  
        Catch ex As Exception  
            f_retval = "9"  
        Finally  
            sCon.Close()  
        End Try  
        Return f_retval  
    End Function  
												

Hi @Aypn CNN ,
I noticed jquery.dataTables.min.js in your error message. Did you initialize the DataTables in Javascript? Maybe you can provide more detailed information?
This error may be due to an incorrectly formatted table. dataTables requires well-formed tables. It must contain <thead> and <tbody> tags, otherwise this error will be thrown.
Also check to make sure all rows (including the header row) have the same number of columns.

Best regards,
Lan Huang

The issue is on your javascript side. Not sure what mData is but you should be able to search for that actual offending line. The callstack indicates that your JS code (contained in the mentioned aspx file??) is enumerating what looks like the rows of a datatable. During the enumeration it is running across the row with this error. You need to set a breakpoint in your .aspx page where that call is occurring and step through it. Scenario 1 is that it is trying to read data from the server response and no data is available. Scenario 2 is that you have rows of data but one of the rows is missing the field you're looking for. You can use the browser tools to look at the data coming back from the server to identify which scenario it is.

I understand what the issue is, but I have no idea how to solve it!
When I perform this with Model Popup, an error occurs, but without Model Popup, everything goes as expected. Tell me how to fix this with Model Popup, please. (But It must preform within Popup)

*This is my Model Popup window, How I fix the issue?*   
<div id="PopuBankDocUL" class="modal fade" role="dialog" data-backdrop="static">  
                            <div class="modal-dialog">  
                                <div class="modal-content">  
                                    <div class="modal-header" style="background-color: #008FBD; color: #fff;">  
                                        <button type="button" class="close" data-dismiss="modal" style="background-color: red; padding-left: 5px; padding-right: 5px; color: #fff;">&times;</button>  
                                        <h3 class="modal-title">Claiment Bank Statement/Passbook/Cheque Upload</h3>  
                                        <asp:Label ID="lbl_UploadedFileName" runat="server" ForeColor="#CC0000" Font-Size="XX-Small" text="11073204_SS_ErrMsg.png"></asp:Label>  
                                    <div class="modal-body">  
                                            <div class="row table-responsive" id="pnl_DocProp" runat="server" style="overflow-y: auto">  
                                                <div class="box box-default" style="left: 0px; top: 0px">  
                                                    <div class="box-header with-border" style="left: 0px; top: 0px">  
                                                        <h3 class="box-title" style="font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif"><b>Pls upload scanned Image/PDF Only, allowed 2MB File size</b></h3>  
                                                        <div class="box-tools pull-right">  
                                                            <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>  
                                                    <!-- /.box-header -->  
                                                    <div class="box-body">  
                                                        <div class="col-md-3">  
                                                            <div class="form-group">  
                                                                <label>Loan ID</label>  
                                                                <asp:Label ID="lbl_LoanIDPopu" runat="server" Text="" CssClass="form-control smalltext" BorderColor="#0066FF" BorderStyle="Solid" BorderWidth="1px"></asp:Label>  
                                                        <div class="col-md-5">  
                                                            <div class="form-group">  
                                                                <label>Bank Name</label>  
                                                                <asp:Label ID="Lbl_BankName" runat="server" Text="" CssClass="form-control smalltext" BorderColor="#0066FF" BorderStyle="Solid" BorderWidth="1px"></asp:Label>  
                                                        <div class="col-md-4">  
                                                            <div class="form-group">  
                                                                <label>Bank Acct No.</label>  
                                                                <asp:Label ID="lbl_BankAcctNo" runat="server" Text="" CssClass="form-control smalltext" BorderColor="#0066FF" BorderStyle="Solid" BorderWidth="1px"></asp:Label>  
                                                        <div class="col-md-5">  
                                                            <div class="form-group">  
                                                                <label>01.Bank Proof Type *</label>  
                                                                <asp:DropDownList ID="ddlBankDocType" runat="server" CssClass="form-control" Width="170px">  
                                                                    <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>  
                                                                    <asp:ListItem Text="Bank Statement" Value="1"></asp:ListItem>  
                                                                    <asp:ListItem Text="Bank Passbook" Value="2"></asp:ListItem>  
                                                                    <asp:ListItem Text="Cancelled Cheque" Value="3"></asp:ListItem>  
                                                                </asp:DropDownList>  
                                                                <asp:RequiredFieldValidator ID="Rfv_DDLBankDoc" runat="server" ErrorMessage="Please Select a Bank uploading Document Type!" InitialValue="0" ControlToValidate="ddlBankDocType" ValidationGroup="group3" Display="None"></asp:RequiredFieldValidator>  
                                                        <div class="col-md-6">  
                                                            <div class="form-group">  
                                                                <label>02.Bank Last Transaction Date *</label>  
                                                                <div class="input-group date">  
                                                                    <div class="input-group-addon">  
                                                                        <i class="fa fa-calendar"></i>  
                                                                    <asp:TextBox ID="txt_TransactionDate" runat="server" CssClass="form-control" placeholder="Future Date NotAllow" Width="200px" autocomplete="off"></asp:TextBox>  
                                                                    <asp:RequiredFieldValidator ID="RFV_TxnDate" Display="None" runat="server" ErrorMessage="Transaction Date shoud not null!" ForeColor="red" ControlToValidate="txt_TransactionDate" ValidationGroup="group3"></asp:RequiredFieldValidator>  
                                                        <div class="col-md-6">  
                                                            <div class="form-group">  
                                                                <label>3.Pls Upload Bank Proof</label><label style="color: red;"> *</label>  
                                                                <asp:FileUpload ID="FUBankProof" type="file" class="form-control" Width="250px" runat="server" accept=".bmp,.gif,.png,.jpg,.jpeg,.pdf" />  
                                                                <asp:RequiredFieldValidator ErrorMessage="Please upload valid Scanned Bank Statment / Passbook / Cancelled Cheque. Image or PDF files only allowed" ControlToValidate="FUBankProof" runat="server" Display="None" ValidationGroup="group3"/>  
                                                                <asp:RegularExpressionValidator ID="RValFu1" ValidationExpression="^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.bmp|.BMP|.gif|.GIF|.png|.PNG|.jpg|JPG|.jpeg|.JPEG|.pdf|.PDF)$" ControlToValidate="FUBankProof" runat="server" ErrorMessage="JPG|PDF|Image Files Only" Display="None" />  
                                                                <asp:CustomValidator ID="Cvali_FuSize" runat="server" ErrorMessage="" ControlToValidate="FUBankProof" ClientValidationFunction="fUpload();" />  
                                                        <div class="col-md-3">  
                                                            <div class="form-group">  
                                                                <label>04.For Upload</label>  
                                                                <asp:Button ID="BtnUpload" runat="server" Text="Click Upload" class="btn btn-primary" Visible="true" OnClientClick="btnfileUload()" ></asp:Button>  
                                                        <div class="col-md-3">  
                                                            <div class="form-group">  
                                                                <label>05.File View</label>  
                                                                <asp:ImageButton ID="ImgBtn_Preview" runat="server" ImageUrl="~/Images/dwnload_ico.png" Height="30px" Width="30px" OnClientClick="fdwload()" />  
                                                        <div class="col-md-12">  
                                                            <progress id="fileProgress" style="display: none"></progress>  
                                                            <div class="progress" style="display: none">  
                                                                <div class="progress-bar" role="progressbar"></div>  
                                                            <div id="lblfuMessage" style="color: Green"></div>  
                                                        <div class="col-md-6">  
                                                            <div class="form-group">  
                                                                <label>04.Remarks</label>  
                                                                <asp:TextBox ID="txtRemarks" runat="server" CssClass="form-control" TextMode="SingleLine" placeholder="100 Chars only" MaxLength="100" Style="text-transform: uppercase" onkeydown="return((event.keyCode >= 65 && event.keyCode <= 120) || (event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode==8)|| (event.keyCode==9) || (event.keyCode==55) || (event.keyCode==16) || (event.keyCode==110) || (event.keyCode==190) || (event.keyCode==188) || (event.keyCode==35) || (event.keyCode==36) || (event.keyCode==37) || (event.keyCode==38) || (event.keyCode==39) || (event.keyCode==40) || (event.keyCode==46) || (event.keyCode==32));"></asp:TextBox>  
                                                        <div class="col-md-12">  
                                                            <center>   
                                                            <div class="row">  
                                                              <asp:Button ID="btnImgsubmit" runat="server" Text="Save"  class="btn btn-primary" Visible="true" OnClientClick="postBankTxn()"   ></asp:Button>  
                                                              <%--&nbsp;<asp:Button ID="btnReset" runat="server" Text="Reset"  class="btn btn-danger" Visible="true" ></asp:Button>--%>  
                                                              &nbsp;<button class="btn btn-danger" data-dismiss="modal" type="button">Close</button>  
                                                                <asp:ValidationSummary runat="server" ShowMessageBox="true" ShowSummary="false" ValidationGroup="group3" HeaderText="Fix the Following Errors" ForeColor="#CC0000" />  
                                                              </center>  
												

The code you posted has no loop construct nor a reference to mdata. I don't believe the issue is in your code that you posted. It could be triggering the actual error somewhere else though. Did you grep your code for mdata? If so then what did you find? If there is no reference then where are you looping through an array on the JS side?

The error itself seems to indicate that you're trying to bind a control to data that is null. But it is happening in JQuery so it is being triggered by the client side code.

I have identified issue, and fixed it, problem is in updatepannel only, I have added following buttons control in Triggers, as follows. all issues solved.

Thanks,

<Triggers>  
<asp:AsyncPostBackTrigger ControlID="BtnUpload" />  
<asp:AsyncPostBackTrigger ControlID="btnImgsubmit" />  
</Triggers>  
</asp:UpdatePanel>