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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditionally Display edit button in datagrid 1

Status
Not open for further replies.

TerryDad2

Programmer
Jul 10, 2002
29
0
0
US
I have a data grid where I want a button column to show an "edit" button only when the record is "owned" by the user but also show all other records in the table. The owner is a column in the same table the data is pulled from.

How does one conditionally have a buttoncolumn display the button?
 
You use the onItemDataBound event of the datagrid.

Once in this event handler, you can access the dataGridItemEventArgs argument's item collection to drill down into the various controls on the item (which literally translates to a row on your datagrid). You can examine values, show/hide controls, change attributes, merge cells, etc...

Please reference 4guysfromrolla's excellent article on the datagrid for more information, which you can find a link for here:
thread855-447401

If you hit roadblocks, then post back, and we can walk through it.
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
Thanks. I finally have time to look at what you've sent.
 
Thanks. That article gave me the info I needed to do what I wanted. Thanks for the direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top