By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,688 Members | 1,862 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,688 IT Pros & Developers. It's quick & easy.

DataGrid Edit, Update handler currency column...

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.