Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello I write one function includes one page method which is working fine in IE but not in google chrome and Firefox..
Below is my code
C#
<script type="text/javascript">
        function TestScriprt(query) {
            var strQuery = query;
           
            //Stop post back to server
            var table, tbody, i, rowLen, row, j, colLen, cell, cell1;
            var colArray = new Array();
            var rowArray = new Array();
            table = document.getElementById("<%=GrdDynamic.ClientID %>");
         


            tbody = table.tBodies[0];

            for (i = 0, rowLen = tbody.rows.length; i < rowLen; i++) {

                row = tbody.rows[i];
                for (j = 0, colLen = row.cells.length; j < colLen; j++) {
                    cell1 = row.cells[j];
                    cell = table.rows[i].cells[j].childNodes[0].innerHTML;
                    var cell2 = table.rows[i].cells[j].childNodes[0].value;

                    if (i == 0) {
                       
                        colArray[j] = new Array();
                        colArray[j] = cell;
                        //alert("colArray[" + j + "]" + colArray[j]);
                    }
                    else if (i > 0) {
                        // Age
                        //alert("--Found age: " + cell1.innerHTML);
                        if (j < 2) {
                            rowArray[j] = new Array();
                            rowArray[j] = cell;
                            //alert("rowArray[" + j + "]" + rowArray[j]);
                        }
                        else {
                            rowArray[j] = new Array();
                            rowArray[j] = cell2;
                           
                        }
                    }
                }

                if (i > 0) {
                    PageMethods.ProcessIT(colArray, rowArray, strQuery, onSucess, onError);

                    function onSucess(result) {
                        //alert(result);
                    }
                    function onError(result) {
                        //alert('Something wrong.');
                    }
                }                      
            }
         

           
            return false;
}
</script>

C#
[WebMethod]
    public static string ProcessIT(string[] colArr, string[] rowArr,string query)
    {
    
        int k = 0;
        type = "";
        Sal = 0;
        totSal = 0;
        id = 0;
        for (int i = 0; i < colArr.Length; i++)
        {
            name = rowArr[0];
            empId =Convert.ToInt64( rowArr[1]);

            if (i >= 2)
            {
                if (k ==0)
                {
                    for (int j = 2; j <= addColCount+1; j++)
                    {
                        string colName = colArr[j];
                        getAddSalCompIDType(colName, rowArr[j],rowArr[colArr.Length-1]);
                        salGen = new Salary_Generation();
                        salGen.customer_Id = customerId;
                        salGen.date = date;
                        salGen.Emp_id = empId;
                        salGen.Sal_cat_type = type;
                        salGen.sal_toatal = totSal;
                        salGen.Salary = Sal;
                        salGen.user_Id = userId;
                        salGen.Salary_Comp_Id = id;
                        if (query == "insert")
                        {
                            string res = salGen.InsertSalaryGeneration(salGen);
                        }
                        else if (query == "update")
                        {
                            string res = salGen.UpdateSalaryGeneration(salGen);
                        }
                        else
                        {
                            string res = salGen.DeleteSalaryGeneration(salGen);
                        }
                    }
                }

                else if(k==1)
                {
                    for (int j = 2 + addColCount; j <= colArr.Length - 2; j++)
                    {
                        string colName = colArr[j];
                        getDedSalCompIDType(colName,rowArr[j], rowArr[colArr.Length - 1]);
                        salGen = new Salary_Generation();
                        salGen.customer_Id = customerId;
                        salGen.date = date;
                        salGen.Emp_id = empId;
                        salGen.Sal_cat_type = type;
                        salGen.sal_toatal = totSal;
                        salGen.Salary = Sal;
                        salGen.user_Id = userId;
                        salGen.Salary_Comp_Id = id;

                        if (query == "insert")
                        {
                            string res = salGen.InsertSalaryGeneration(salGen);
                        }
                          else if(query == "update")
                        {
                            string res = salGen.UpdateSalaryGeneration(salGen);
                        }
                        else
                        {
                            string res = salGen.DeleteSalaryGeneration(salGen);
                        }
                    }
                }
                k++;
            }
        }
       
        return "result";
    }
Posted
Updated 30-Jul-14 21:14pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900