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 195013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:38:40+00:00 2026-05-11T16:38:40+00:00

I am using an ASP.NET GridView control with a TemplateColumn which has a TextBox

  • 0

I am using an ASP.NET GridView control with a TemplateColumn which has a TextBox in the ItemTemplate. I am binding the Text of the TextBox with the values from database. The database holds these values with five decimal points, and for the interface I would like to display only two decimals.

The user can make changes to this grid. When I’m saving, I would like to be able to get all five decimals for the values that are not changed. Since it is displayed as two decimals, I was only able to read two decimals on postback? Is there a way around this other than saving the actual value in a hidden variable?

Thanks,

sridhar

  • 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-11T16:38:40+00:00Added an answer on May 11, 2026 at 4:38 pm

    I have a formatCurrency plugin that could help you out here. What you’ll want to do is display the data in a textbox and use a hiddenfield to bind the data. This way, not only do you retain the decimal places, but you can accept more than two decimal places as input.

    Here is a sample that should work.

    <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js">
    </script>
    <script type="text/javascript" src="jquery.formatCurrency.js">
    </script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('.editNumber').formatCurrency();
            $('.editNumber').blur(function(e) {
                var val = $(this).toNumber();
                $(this).next('input:hidden').val(val)
                    .end().formatCurrency();
    
            });
        });
    </script>
    <asp:GridView runat="server" ID="GridView1" AutoGenerateColumns="false">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:TextBox runat="server" CssClass="editNumber" ID="EditNumber" Text='<%# Eval("Price") %>' />
                    <asp:HiddenField runat="server" ID="HiddenNumber" Value='<%# Bind("Price") %>' />
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You could try with PyCallGraph From its documentation: Python Call… May 11, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer Here's what I did. #!/bin/bash # share sqldeveloper config via… May 11, 2026 at 11:30 pm
  • Editorial Team
    Editorial Team added an answer You could try this: $newArray = preg_replace('/mailto:([\w-]+@([\w-]+\.)+[\w-]+)/i', '$1', $oldArray); Haven't… May 11, 2026 at 11:30 pm

Related Questions

I'm hoping someone can help me with a question I have about images and
I'm new to MVC, and am not following how you'd do paging and sorting
I am not a big fan of datasets so I use POCO to return
I have the following structure in an aspx page: <asp:Panel ID=pnlCust runat=server> <asp:GridView ID=gvMaster

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.