Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid Button Column Woes...

Status
Not open for further replies.

jfrost10

Programmer
Jun 3, 2001
2,004
CA
Hey gang

I have a data grid on a page with a button column. Problem is, I don't have a hot clue how to get the value from a certain column i want when the user clicks the button.

Any thoughts on how these darn things work?

Thanks,
Jack

P.S. I figured out the method thats triggered when the button is clicked, just don't know the syntax thats supposed to go in there.
 
Nevermind, figured it out. For anyone else wondering, what you have to do is (this is all within visual studio) right click on the datagrid and select properties. This will bring up a dialog box that enables you to add a button column to it. Now, within the code screen, if you select your datagrid you can select the ItemCommand sub to add code to. The e in the arguments happens to be the row that the button is located in. So if you wanted to get the value of the field in the second column and assign that to a variable, you just do:
strID = CStr(e.Item.Cells(1).Text)
and that will get the value.

Now for my next trick: formatting the damned thing!
;)

Jack
 
Ooops, sorry, my bad. To access that column dialog box I mentioned above, you click the Columns property in the property box, and that brings it up.

Sorry
:)

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top