Home All Groups Group Topic Archive Search About

GridView: Show SELECT button in certain rows

Author
4 May 2006 9:12 PM
marlin
I would like to have the SELECT button displayed in certain rows depending on the value of a particular column in the GridView control. If the value in that column is true, I would like the SELECT button to be displayed.  Otherwise, I don't want the SELECT button to show.

I converted all fields into TemplateField and have been trying to use the RowCreated event to determine when to display the SELECT button. So far I have no luck in accessing and evaluating the value of that particular column.

Is there a way that I can do this? -- marlin ------------------------------------------------------------------------ Posted via http://www.codecomments.com ------------------------------------------------------------------------

Author
8 May 2006 4:40 PM
Brock Allen
The GridViewRow has a DataItem property which is a reference to the row of
data it was built from. Use DataBinder.Eval() to access the data you need
form the original data source to determine if the button should be visible
or not.

-Brock
http://staff.develop.com/ballen


Show quoteHide quote
> I would like to have the SELECT button displayed in certain rows
> depending on the value of a particular column in the GridView control.
> If the value in that column is true, I would like the SELECT button to
> be displayed.  Otherwise, I don't want the SELECT button to show.
>
> I converted all fields into TemplateField and have been trying to use
> the RowCreated event to determine when to display the SELECT button.
> So far I have no luck in accessing and evaluating the value of that
> particular column.
>
> Is there a way that I can do this?
>
> --
> marlin
> ----------------------------------------------------------------------
> --
> Posted via http://www.codecomments.com
> ----------------------------------------------------------------------
> --