Click here to Skip to main content
12,510,594 members (49,968 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL
Hello everyone, today I have the next problem:

I'm doing a conection with a database, and I show the info with a DataGrid.

This control has other control for edit the info loaded, but the edition makes of by rows; I need to change this, for do the edition for columns.

Thanks!
Posted 22-Sep-12 2:46am
TANicox1.4K
Comments
arshad alam 22-Sep-12 8:51am
   
Kindly explain your question. its not clear
TANicox 22-Sep-12 9:06am
   
Into the GridView, you can put a CommandField, ok?

Well, With this CommandField you can edit the table by rows.
I need to make the table editable by columns.

|Column1|Column2|CmdColumn|
| xxxx | xxxx | Edit |< This edit the selected row


| Edit | Edit |< I need edit the entire column
|Column1|Column2|
| xxxx | xxxx |

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If you mean something along the lines of:
UPDATE db SET col1 = 'someVal'
I would add a row of TextBoxes above or below the DataGrid and when the user hits enter or clicks a button read all of the TextBox values, validate them, and then write a dynamic SQL query to manually update the data. After that reload the DataGrid to show the changes.
This way you can do any kind of validation, and you are in complete control of what can and can not be updated.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160929.1 | Last Updated 22 Sep 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100