how to use parseFloat with Bind in gridview textbox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Nivia

    how to use parseFloat with Bind in gridview textbox?

    Am trying to bind a value that comes from DB to a asp:textbox in gridview. but am unable to use bind & parsefloat together. where do i include parsefloat in the below code line

    Code:
     
    
    Text='<%# Bind("Area") %>'
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I'm not sure this mixing of client-side and server-side code is correct or perhaps I've misunderstood the problem. Can you post more code and give some context to your problem to help solve it.

    Comment

    • Nivia

      #3
      This is the coding that i am using. Now when a user enters a number like 0.0000006, the number being displayed after the page refresh is an exponential number like '07E-06' or so. I want this to be displayed as a proper decimal number. now how do i do that?. the data type used in DB is double.

      Code:
      <ItemTemplate>
                                          <asp:Label ID="lblArea" runat="server" CssClass="labelWidthSmall_PP"  Text='<%# Bind("Area") %>'></asp:Label>
                                      </ItemTemplate>
      Last edited by gits; Oct 8 '10, 05:39 PM. Reason: fix [code][/code] tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        As suspected, you're mixing up ASP.NET (server-side) with JavaScript (client-side). If you want the number to be displayed correctly when the page loads, use server-side code. There's no point in using client-side code to change a number display unless the number itself was generated client-side.

        Comment

        Working...