MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ASP .NET Binding with Format {0:N0} is one way only

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp
Author Message
jehugaleahsa



Joined: 19 Oct 2007
Posts: 12

PostPosted: Tue Feb 26, 2008 8:14 pm    Post subject: ASP .NET Binding with Format {0:N0} is one way only Reply with quote

Hello:

I am working on an ASP .NET page and I have a integral value being
bound to a textbox.

I have it formatted with {0:N0} so that I get commas, but not decimal
places. When I go to update, I get an 'Input String not in the correct
format' error. I am not sure why it is okay for interface to correctly
display my data, but then not be able to update.

What is the fix?

Thanks,
Travis

Archived from group: microsoft>public>dotnet>languages>csharp
Back to top
View user's profile Send private message
Misbah Arefin



Joined: 11 Jan 2008
Posts: 3

PostPosted: Wed Feb 27, 2008 8:09 am    Post subject: RE: ASP .NET Binding with Format {0:N0} is one way only Reply with quote

try

public static decimal ToDecimal(string value)
{
if (value == null || value.Length == 0)
return 0;
if (value == null)
throw new ArgumentNullException("value");
return Decimal.Parse(value.Replace(" ", ""), NumberStyles.AllowThousands |
NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol,
CultureInfo.CurrentCulture);
}

--
Misbah Arefin
https://mcp.support.microsoft.com/profile/MISBAH.AREFIN
http://www.linkedin.com/in/misbaharefin


"jehugaleahsa@gmail.com" wrote:

> Hello:
>
> I am working on an ASP .NET page and I have a integral value being
> bound to a textbox.
>
> I have it formatted with {0:N0} so that I get commas, but not decimal
> places. When I go to update, I get an 'Input String not in the correct
> format' error. I am not sure why it is okay for interface to correctly
> display my data, but then not be able to update.
>
> What is the fix?
>
> Thanks,
> Travis
>
Back to top
View user's profile Send private message
jehugaleahsa



Joined: 19 Oct 2007
Posts: 12

PostPosted: Wed Feb 27, 2008 11:35 am    Post subject: Re: ASP .NET Binding with Format {0:N0} is one way only Reply with quote

On Feb 27, 4:09 am, Misbah Arefin
wrote:
> try
>
> public static decimal ToDecimal(string value)
> {
>   if (value == null || value.Length == 0)
>     return 0;
>   if (value == null)
>     throw new ArgumentNullException("value");
>   return Decimal.Parse(value.Replace(" ", ""), NumberStyles.AllowThousands |
> NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol,
> CultureInfo.CurrentCulture);
>
> }
>
> --
> Misbah Arefinhttps://mcp.support.microsoft.com/profile/MISBAH.AREFINhttp://www.linkedin.com/in/misbaharefin
>
>
>
> "jehugalea...@gmail.com" wrote:
> > Hello:
>
> > I am working on an ASP .NET page and I have a integral value being
> > bound to a textbox.
>
> > I have it formatted with {0:N0} so that I get commas, but not decimal
> > places. When I go to update, I get an 'Input String not in the correct
> > format' error. I am not sure why it is okay for interface to correctly
> > display my data, but then not be able to update.
>
> > What is the fix?
>
> > Thanks,
> > Travis- Hide quoted text -
>
> - Show quoted text -

That comes with too much work for something that should be built in.
Back to top
View user's profile Send private message
jehugaleahsa



Joined: 19 Oct 2007
Posts: 12

PostPosted: Wed Feb 27, 2008 11:55 am    Post subject: Re: ASP .NET Binding with Format {0:N0} is one way only Reply with quote

On Feb 27, 4:09 am, Misbah Arefin
wrote:
> try
>
> public static decimal ToDecimal(string value)
> {
>   if (value == null || value.Length == 0)
>     return 0;
>   if (value == null)
>     throw new ArgumentNullException("value");
>   return Decimal.Parse(value.Replace(" ", ""), NumberStyles.AllowThousands |
> NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol,
> CultureInfo.CurrentCulture);
>
> }
>
> --
> Misbah Arefinhttps://mcp.support.microsoft.com/profile/MISBAH.AREFINhttp://www.linkedin.com/in/misbaharefin
>
>
>
> "jehugalea...@gmail.com" wrote:
> > Hello:
>
> > I am working on an ASP .NET page and I have a integral value being
> > bound to a textbox.
>
> > I have it formatted with {0:N0} so that I get commas, but not decimal
> > places. When I go to update, I get an 'Input String not in the correct
> > format' error. I am not sure why it is okay for interface to correctly
> > display my data, but then not be able to update.
>
> > What is the fix?
>
> > Thanks,
> > Travis- Hide quoted text -
>
> - Show quoted text -

I did what you said with the FormView and GridView Updating and
Inserting event handlers. I'm not too happy about it. I'm going to go
boil my head.
Back to top
View user's profile Send private message
jehugaleahsa



Joined: 19 Oct 2007
Posts: 12

PostPosted: Wed Feb 27, 2008 12:13 pm    Post subject: Re: ASP .NET Binding with Format {0:N0} is one way only Reply with quote

On Feb 27, 4:09 am, Misbah Arefin
wrote:
> try
>
> public static decimal ToDecimal(string value)
> {
>   if (value == null || value.Length == 0)
>     return 0;
>   if (value == null)
>     throw new ArgumentNullException("value");
>   return Decimal.Parse(value.Replace(" ", ""), NumberStyles.AllowThousands |
> NumberStyles.AllowDecimalPoint | NumberStyles.AllowCurrencySymbol,
> CultureInfo.CurrentCulture);
>
> }
>
> --
> Misbah Arefinhttps://mcp.support.microsoft.com/profile/MISBAH.AREFINhttp://www.linkedin.com/in/misbaharefin
>
>
>
> "jehugalea...@gmail.com" wrote:
> > Hello:
>
> > I am working on an ASP .NET page and I have a integral value being
> > bound to a textbox.
>
> > I have it formatted with {0:N0} so that I get commas, but not decimal
> > places. When I go to update, I get an 'Input String not in the correct
> > format' error. I am not sure why it is okay for interface to correctly
> > display my data, but then not be able to update.
>
> > What is the fix?
>
> > Thanks,
> > Travis- Hide quoted text -
>
> - Show quoted text -

Oh, and thanks.

Back to top
View user's profile Send private message
Display posts from previous:   
Related Topics:
How to format a datagrid cell for money format? Hello all, How can I do that? Format a datagrid cell to money format. I nedd to show like this $500,00, but shows 500,0000. Thanks in advance. Sorry my English. Fernando Lopes Brazil

combobox binding I have a form with many comboboxes. I filled some of the comboboxes by binding them to a dataset of lookup tables. I don't know how can I bind the list of items to one thing and the data to another? i.e. I want the list bound to lookup info and I know the

combolist binding Hi, I'm trying to re-bind the combolist using the "datasource" property after the form was loaded but the combolist doesn't populate the data in datatable. However if the assignment of the datasource is done before the form was loaded, the data in datata

Binding CheckBox I am currently getting the error "Object cannot be cast from DBNull to other types." while selecting tab'd pages with bound checkboxes on them. Any tabs with no bound checkboxes show properly whereas tabs with checkboxes bound (either checked or unchecked

binding error I am having this binding issue: LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from LOG: Post-policy
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> C Sharp All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group