473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

DataGrid Edit, Update handler currency column...

Hi all,

Have a datagrid that displays the price column of a table.

Went to the Datagrid's Property builder and set the 'Data Formatting
expression' for the PRICE column to {0:c}, so that the dollar sign, the
comma, and the decimal are included (i.e. $44,644.48)

Managed to update the price column of the datagrid back to the database, as
long as, the user doesn't delete the dollar sign (in the 0 position).

Is there a way to change the format of the price column once the user clicks
the Edit option -so that the price column (in edit mode) doesn't have the
dollar sign and comma showing and just displays the whole number or the
decimal number for the user to change? What I'm looking for is once the user
clicks the Edit option, the '$' for the price value doesn't get displayed in
edit mode.

Any suggestions would be appreciated.

Thanks.

bebop
Nov 19 '05 #1
5 4548
Perhaps do a template column and for the ItemTemplate do one formatting (one
w/ currency symbol) and the EditItemTemplate just do a decimal formatting.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

Have a datagrid that displays the price column of a table.

Went to the Datagrid's Property builder and set the 'Data Formatting
expression' for the PRICE column to {0:c}, so that the dollar sign,
the comma, and the decimal are included (i.e. $44,644.48)

Managed to update the price column of the datagrid back to the
database, as long as, the user doesn't delete the dollar sign (in the
0 position).

Is there a way to change the format of the price column once the user
clicks the Edit option -so that the price column (in edit mode)
doesn't have the dollar sign and comma showing and just displays the
whole number or the decimal number for the user to change? What I'm
looking for is once the user clicks the Edit option, the '$' for the
price value doesn't get displayed in edit mode.

Any suggestions would be appreciated.

Thanks.

bebop


Nov 19 '05 #2
Thanks Brock. Using the TemplateColumn did the trick.

Used a label for the ItemTemplate and then a textbox for EditItemTemplate.
There's one thing left:

when editing the textbox of the TemplateColumn, I noticed that if a user
enters a price 456.5678 my label doesn't come back with 456.56

How do I go about fixing this? I tried using the text format(s)
{0:N},{0:F}, and then a custom format {0:#,##.##} and neither of these work.

Is there anyway to solve this? The above price also can't round up(so far
hasn't)
so, if it's 456.5678, the price is 456.56 and not 457 or 456.57

Any suggestions would be appreciated.

Thanks.

bebop
"Brock Allen" wrote:
Perhaps do a template column and for the ItemTemplate do one formatting (one
w/ currency symbol) and the EditItemTemplate just do a decimal formatting.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

Have a datagrid that displays the price column of a table.

Went to the Datagrid's Property builder and set the 'Data Formatting
expression' for the PRICE column to {0:c}, so that the dollar sign,
the comma, and the decimal are included (i.e. $44,644.48)

Managed to update the price column of the datagrid back to the
database, as long as, the user doesn't delete the dollar sign (in the
0 position).

Is there a way to change the format of the price column once the user
clicks the Edit option -so that the price column (in edit mode)
doesn't have the dollar sign and comma showing and just displays the
whole number or the decimal number for the user to change? What I'm
looking for is once the user clicks the Edit option, the '$' for the
price value doesn't get displayed in edit mode.

Any suggestions would be appreciated.

Thanks.

bebop


Nov 19 '05 #3
I forgot if you were using a validation control. I'd suggest using one to
make sure the format is how you want it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks Brock. Using the TemplateColumn did the trick.

Used a label for the ItemTemplate and then a textbox for
EditItemTemplate. There's one thing left:

when editing the textbox of the TemplateColumn, I noticed that if a
user enters a price 456.5678 my label doesn't come back with 456.56

How do I go about fixing this? I tried using the text format(s)
{0:N},{0:F}, and then a custom format {0:#,##.##} and neither of these
work.

Is there anyway to solve this? The above price also can't round up(so
far
hasn't)
so, if it's 456.5678, the price is 456.56 and not 457 or 456.57
Any suggestions would be appreciated.

Thanks.

bebop
"Brock Allen" wrote:
Perhaps do a template column and for the ItemTemplate do one
formatting (one w/ currency symbol) and the EditItemTemplate just do
a decimal formatting.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

Have a datagrid that displays the price column of a table.

Went to the Datagrid's Property builder and set the 'Data Formatting
expression' for the PRICE column to {0:c}, so that the dollar sign,
the comma, and the decimal are included (i.e. $44,644.48)

Managed to update the price column of the datagrid back to the
database, as long as, the user doesn't delete the dollar sign (in
the 0 position).

Is there a way to change the format of the price column once the
user clicks the Edit option -so that the price column (in edit mode)
doesn't have the dollar sign and comma showing and just displays the
whole number or the decimal number for the user to change? What I'm
looking for is once the user clicks the Edit option, the '$' for the
price value doesn't get displayed in edit mode.

Any suggestions would be appreciated.

Thanks.

bebop


Nov 19 '05 #4
Where is the validation control? Do you mean a RequireFieldValidator control
to check the format inside the Template price column? Or use a regular
expression?

bebop

"Brock Allen" wrote:
I forgot if you were using a validation control. I'd suggest using one to
make sure the format is how you want it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks Brock. Using the TemplateColumn did the trick.

Used a label for the ItemTemplate and then a textbox for
EditItemTemplate. There's one thing left:

when editing the textbox of the TemplateColumn, I noticed that if a
user enters a price 456.5678 my label doesn't come back with 456.56

How do I go about fixing this? I tried using the text format(s)
{0:N},{0:F}, and then a custom format {0:#,##.##} and neither of these
work.

Is there anyway to solve this? The above price also can't round up(so
far
hasn't)
so, if it's 456.5678, the price is 456.56 and not 457 or 456.57
Any suggestions would be appreciated.

Thanks.

bebop
"Brock Allen" wrote:
Perhaps do a template column and for the ItemTemplate do one
formatting (one w/ currency symbol) and the EditItemTemplate just do
a decimal formatting.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi all,

Have a datagrid that displays the price column of a table.

Went to the Datagrid's Property builder and set the 'Data Formatting
expression' for the PRICE column to {0:c}, so that the dollar sign,
the comma, and the decimal are included (i.e. $44,644.48)

Managed to update the price column of the datagrid back to the
database, as long as, the user doesn't delete the dollar sign (in
the 0 position).

Is there a way to change the format of the price column once the
user clicks the Edit option -so that the price column (in edit mode)
doesn't have the dollar sign and comma showing and just displays the
whole number or the decimal number for the user to change? What I'm
looking for is once the user clicks the Edit option, the '$' for the
price value doesn't get displayed in edit mode.

Any suggestions would be appreciated.

Thanks.

bebop


Nov 19 '05 #5
Yeah, I mean a RequiredField or RegEx Validator.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Where is the validation control? Do you mean a RequireFieldValidator
control to check the format inside the Template price column? Or use
a regular expression?

bebop

"Brock Allen" wrote:
I forgot if you were using a validation control. I'd suggest using
one to make sure the format is how you want it.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Thanks Brock. Using the TemplateColumn did the trick.

Used a label for the ItemTemplate and then a textbox for
EditItemTemplate. There's one thing left:

when editing the textbox of the TemplateColumn, I noticed that if a
user enters a price 456.5678 my label doesn't come back with 456.56

How do I go about fixing this? I tried using the text format(s)
{0:N},{0:F}, and then a custom format {0:#,##.##} and neither of
these work.

Is there anyway to solve this? The above price also can't round
up(so
far
hasn't)
so, if it's 456.5678, the price is 456.56 and not 457 or 456.57
Any suggestions would be appreciated.
Thanks.

bebop
"Brock Allen" wrote:
Perhaps do a template column and for the ItemTemplate do one
formatting (one w/ currency symbol) and the EditItemTemplate just
do a decimal formatting.

-Brock
DevelopMentor
http://staff.develop.com/ballen
> Hi all,
>
> Have a datagrid that displays the price column of a table.
>
> Went to the Datagrid's Property builder and set the 'Data
> Formatting expression' for the PRICE column to {0:c}, so that the
> dollar sign, the comma, and the decimal are included (i.e.
> $44,644.48)
>
> Managed to update the price column of the datagrid back to the
> database, as long as, the user doesn't delete the dollar sign (in
> the 0 position).
>
> Is there a way to change the format of the price column once the
> user clicks the Edit option -so that the price column (in edit
> mode) doesn't have the dollar sign and comma showing and just
> displays the whole number or the decimal number for the user to
> change? What I'm looking for is once the user clicks the Edit
> option, the '$' for the price value doesn't get displayed in edit
> mode.
>
> Any suggestions would be appreciated.
>
> Thanks.
>
> bebop
>


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: don | last post by:
I have a datagrid working fine in my ASP page and it is editable using a edit/update/cancel column. All is well, but I have a Total line at the end that I would not want the user to edit, I have...
2
by: don | last post by:
I will try again with this one. I have a datagrid working fine in my ASP page and it is editable using a edit/update/cancel column. All is well, but I have a Total line at the end that I would...
0
by: Tom | last post by:
I created a c# web form. I added a DataGrid1 to it. I added the Edit, Update, Cancel Button Column. I added two Bound columns. All is well. But when I run the app and press the edit...
0
by: Steve Kallal | last post by:
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The...
3
by: Leo | last post by:
I have a datagrid with the first column as a Edit,Update,Cancel button column. The other 5 columns are template columns. When I click the Edit button in IE6 the row correctly displays the...
3
by: pmud | last post by:
Hi, I have an ASP.NET application using C# code. I am using a datagrid to display records from a database based on a user input, i.e a user enters a compnay name in text box & when he clicks a...
4
by: drakuu | last post by:
Hello there, I have DataGrid with some records and I would like to edit it right in the datagrid using the built in commands. I can't figure out a way to pass to the SQL query the record ID...
3
by: thebison | last post by:
Hi all, I hope someone can help with this relatively simple problem. I am building a timesheet application using ASP.NET C# with Visual Studio 2003.As it is only a protoype application, my...
0
by: Jennifer | last post by:
I've got a datagrid. I want to allow the user to edit in the grid directly. I'm using ASP with VB as the code behind in Visual Studio 2002. I've never had a need or desire to do this before,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.