473,850 Members | 2,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4567
Perhaps do a template column and for the ItemTemplate do one formatting (one
w/ currency symbol) and the EditItemTemplat e 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 EditItemTemplat e.
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 EditItemTemplat e 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
EditItemTemplat e. 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 EditItemTemplat e 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 RequireFieldVal idator 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
EditItemTemplat e. 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 EditItemTemplat e 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 RequireFieldVal idator
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
EditItemTemplat e. 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 EditItemTemplat e 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
1083
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 been trying to figure out how I can get to the Edit link on this row. I would imagine you get to it in the ItemDataBound, but when I look in that cell for any controls there are none. How can I turn off the edit button for any one row.
2
3252
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 not want the user to edit, I have been trying to figure out how I can get to the Edit link on this row. I would imagine you get to it in the ItemDataBound, but when I look in that cell for any controls there are
0
1470
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 button, the text box widht is not dynamic. its fixed! So only a portion
0
1473
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 project lead does not want me to do this with code as he thinks it is too complex. But I cannot find a property in Design View or HTML View that works. Otherwise the edit buttons do not match the appearance of other buttons on the screen. Here is...
3
1640
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 controls defined in the <EditItemTemplate> however when I right click and do a view source I cannot find any of the input textboxes in the source. I have used the ItemDatabound event to try to attach javascript to the textboxes and in debug mode while...
3
2287
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 "Submit" button, only those records are displayed where company name matches with user input. I need the datagrid to be editable. For this i used the walkthrough from ..NET "Using a datagrid for reading & writing data to database" or it was some...
4
9700
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 which I'm editing. SELECT: SelectCommand="SELECT ProviderID, AddressID, Address, Address2, City, State, County, Zip FROM ProviderAddress WHERE (ProviderID = @ProviderID)"
3
2271
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 database has been made in MSDE. My problem is to do with a DataGrid. I have successfully coded the DataGrid so that you can Edit, Update, Cancel. However as my Update Stored Procedure only updates certain columns I would like to make
0
948
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, so I found an Quickstart example at DotNetJunkies.com. I've modified it for my needs and can't get it to work. Specifically, the part where I get the edited cell values does not work. e.Item.Cells(1).Text returns nothing. None of the other...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9741
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10666
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9503
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7899
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5929
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4546
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4140
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.