Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 29th, 2010, 11:03 AM
Authorized User
Points: 169, Level: 3
Points: 169, Level: 3 Points: 169, Level: 3 Points: 169, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: Northampton, , United Kingdom.
Posts: 35
Thanks: 1
Thanked 0 Times in 0 Posts
Default Editing Data in a DataGrid

I have a an ASP:DataGrid which is populated with its DataTable

One column has a number 1-3 in it, which determined one of two values to be entered.

1: Requires an EMAIL
2: Requires a PHONE
3: No requirement

Could someone advise how (perhaps a simple example) I can set the datagrid to edit the values in the email/phone columns, where required. So that the DataTable object in the server side code gets populated correctly.

Many thanks
__________________
Regards,

Sean
  #2 (permalink)  
Old March 30th, 2010, 07:40 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

I would think that you'd code two columns, one for email, one for phone. Then you'd use the information in the 3rd column of the dataset but not for display purposes.

First, I'd recommend handling it as an enumeration so you don't have to deal with the magic numbers, stay semantic. Maybe something like RequiredData with Email = 1, Phone = 2, and Complete = 3. Then your code will be referencing RequiredData.Email, RequiredData.Phone, and RequiredData.Complete which will make your code much more semantic and maintainable.

Then you can use RequiredData.Complete to display each column as plain text. If RequiredData comes back missing a piece of information, then set that column to appear not as text (for one thing you don't have any), but a textbox instead. That allows you to immediately capture the data.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.
  #3 (permalink)  
Old March 31st, 2010, 01:14 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

I recomend to use an ComboBox in order to select ur options in ur grid
__________________
Always,
Hovik Melkomian.
  #4 (permalink)  
Old April 1st, 2010, 02:41 PM
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Quote:
Originally Posted by melvik View Post
I recomend to use an ComboBox in order to select ur options in ur grid
Hadn't thought about that but if the Required data is a user input (show me the user accounts that are complete, show me the accounts that still need email, etc.) then a combobox is the best way to go.

If this is part of an admin panel, just throw them into an XHTML table and sort the items which need info first so they're easy to fill in.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Datagrid toddw607 ASP.NET 2.0 Basics 5 April 26th, 2007 03:06 PM
DataGrid Editing Problem gaurav_jain2403 .NET Framework 1.x 2 December 9th, 2006 04:33 AM
Editing in DataGrid abdul_owiusa ASP.NET 1.0 and 1.1 Professional 0 May 1st, 2006 07:56 AM
Problem with Datagrid Editing pramesh_it ASP.NET 1.0 and 1.1 Basics 0 April 17th, 2006 09:58 AM
Multiplerecord editing in Datagrid vids ASP.NET 1.x and 2.0 Application Design 0 March 10th, 2005 11:41 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.