Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 637495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:37:47+00:00 2026-05-13T20:37:47+00:00

I have a gridview with three textboxes txtOpeningAdv , TxtAdvanceDeducted , TxtClosingAdvance ….. Using

  • 0

I have a gridview with three textboxes txtOpeningAdv , TxtAdvanceDeducted , TxtClosingAdvance….. Using a KeyUp function on TxtAdvanceDeducted i calculated TxtClosingAdvance… My page Shows value in TxtClosingAdvance textbox… But when i accessed it using c# it gives me error Input String was not in a correct format…

When i inspected through firebug,

<input type="text" class="text_box_height_14_width_50" id="ctl00_ContentPlaceHolder1_gridEmployee_ctl02_txtOpeningAdv" readonly="readonly" value="500.00" name="ctl00$ContentPlaceHolder1$gridEmployee$ctl02$txtOpeningAdv">

<input type="text" onkeyup="totalAmount(event,this);" autocomplete="off" class="text_box_height_14_width_50" id="ctl00_ContentPlaceHolder1_gridEmployee_ctl02_TxtAdvanceDeducted" name="ctl00$ContentPlaceHolder1$gridEmployee$ctl02$TxtAdvanceDeducted">

<input type="text" class="text_box_height_14_width_50" id="ctl00_ContentPlaceHolder1_gridEmployee_ctl02_TxtClosingAdvance" readonly="readonly" name="ctl00$ContentPlaceHolder1$gridEmployee$ctl02$TxtClosingAdvance">

This is my gridview,
alt text http://img90.imageshack.us/img90/7237/gridemp.jpg

My c# Code,

foreach (GridViewRow row in gridEmployee.Rows) 
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                DataRow dr = dt.NewRow();
                dr["EmpId"] = Convert.ToInt64(((HiddenField)row.Cells[0].FindControl("HiddenId")).Value);
                dr["FromDate"] = Convert.ToDateTime(GetMonthNumberFromAbbreviation(fromdate[1].ToString()) + '/' + fromdate[0].ToString() + '/' + fromdate[2].ToString());
                dr["ToDate"] = Convert.ToDateTime(GetMonthNumberFromAbbreviation(todate[1].ToString()) + '/' + todate[0].ToString() + '/' + todate[2].ToString());
                dr["DaysPresent"] = Convert.ToDecimal(((TextBox)row.Cells[3].FindControl("TxtDaysPresent")).Text);//(row.Cells[4].Text);
                dr["OpeningAdvance"] = Convert.ToDouble(((TextBox)row.Cells[4].FindControl("txtOpeningAdv")).Text);
                dr["AdvanceDeducted"] = Convert.ToDouble(((TextBox)row.Cells[5].FindControl("TxtAdvanceDeducted")).Text);
                dr["RemainingAdvance"] = Convert.ToDouble(((TextBox)row.Cells[6].FindControl("TxtClosingAdvance")).Text);
                dr["SalaryGiven"] = Convert.ToDouble(((TextBox)row.Cells[7].FindControl("TxtSalary")).Text);
                dr["CreatedDate"] = System.DateTime.Now;
                dt.Rows.Add(dr);
            }
        }

Error is in the line,
dr["RemainingAdvance"] = Convert.ToDouble(((TextBox)row.Cells[6].FindControl("TxtClosingAdvance")).Text);

Input string was not in a correct format

But my gridview has TxtClosingAdvance="400.00"… Its a readonly textbox where its value will be placed from TxtAdvanceDeducted onkeyup event javascript…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:37:48+00:00Added an answer on May 13, 2026 at 8:37 pm

    As a guess, your string value is empty or contains unwanted symbols, try to check the value of ((TextBox)row.Cells[6].FindControl("TxtClosingAdvance")).Text if it contains 400.00 than the error is caused because in server’s regional settings "." is not decimal symbol. If it is empty, that’s mean ASP.NET doesn’t recognizes your JavaScript changes. ASP.NET restores non editable control values from VIEWSTATE on response for security reasons, try to disable VIEWSTATE for that control by setting EnableViewState = false.

    EDIT

    By the way there is an ReadOnly TextBox issue discussed here

    Hope this helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a .net aspx-Page, I have a gridview with textboxes for prices. There is
I have a gridview with three columns of textboxes. It can have as many
I have an Entry Form and a GridView on the same page. Selecting a
I have a gridview which shows all the information of the data table. I
I have desgining gridview ,in which i have applied quicksearch function of jquery for
I have a Gridview with AutoGenerateColumns=False . I am using a TemplateField to display
I have been using gridview since a long time. I have a cant live
I am using ASP.NET to create a page with a GridView that is very
I have an ASP.NET page with a gridview control on it with a CommandButton
I have two forms.. form1 and form2 in form1 i have gridview with three

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.