TextBox Values are always empty in other grid pages

TextBox Values are always empty in other grid pages

AllamAllam Posts: 2Questions: 2Answers: 0

Description of problem:
i'm Using ASP.Net with a gridview and Textboxes in side the gridview, i fill the textboxs with 0 value and when i try to save the values inside the grid, the first page of the grid returns the correct values but the second page always return empty textbox while i can see a zero inside it

$('.custom-datatable').DataTable({
        "paging": true,
        "searching": true,
        "ordering": true,
        'scrollX': true,
        dom: 'Bflrtip',
        buttons: [{ extend: 'excel', text: ' Export To Excel' }            
        ]
        //"order": [[1, "asc"]]
    });

and below is my code behind

foreach (GridViewRow row in gvPayRoll.Rows)
            {
                if (row.Cells[1].Text == " ")
                {
                    #region Save New Payroll
                    tbl_Payroll prObject = new tbl_Payroll();

                    prObject.PR_GUID = Guid.NewGuid();

                    prObject.User_ID = int.Parse(row.Cells[0].Text);
                    prObject.Basic_Salary = clHelper.Encrypt(((TextBox)(row.Cells[4].Controls[1])).Text);
                    prObject.Basic_Salary_Retro = clHelper.Encrypt(((TextBox)(row.Cells[5].Controls[1])).Text);
                    prObject.Adjustment = clHelper.Encrypt(((TextBox)(row.Cells[6].Controls[1])).Text);
                    prObject.Gross_Salary = clHelper.Encrypt(row.Cells[8].Text);
                    clPayRoll.SavePayrollFinal(prObject);
                    #endregion
                    continue;
                }
}

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    I'm not clear what a gridview is. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

Sign In or Register to comment.