Get boundfield value in rowupdating

Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.

In (c#) I'm using a gridview and edit mode to make it easy for the user to change values. I have always used the data Key Names to be able to reach the values from my gridview in codebehind.

Free counters Added on January 19,2012 Follow Me @vmsdurano A bit About Me Disclaimer The opinions expressed herein are my own personal opinions and does not represent the opinions of my employers.

get boundfield value in rowupdating-30get boundfield value in rowupdating-39get boundfield value in rowupdating-75get boundfield value in rowupdating-40

The Grid View control is the successor to the Data Grid and extends it in a number of ways.

The idea is to only allow a command to be performed on specific people. I'd prefer a declarative solution to a procedural one. For me converting the commandfield to a templatefield control is not an option, as the commandfield comes with built-in functionality that I would otherwise have to create myself, for example the fact that it changes to "Update Cancel" when Edit is clicked, and that when Edit is clicked, all the cells in the row which are labels become textboxes, etc.

In my approach, you can leave the commandfield as is, then you can hide it as needed via code behind.

In this example, I am hiding it if the field "Scenario" of the grid shows the text "Actual" for the relevant row of the Row Data Bound event.

I almost gave up and just convert my commandfield to a templatefield but I know it can be done so I keep on searching for it. (Although I'm still not sure what the asker meant about the declarative answer.) If this was based on roles you could use the multiview panel but not sure if you could do the same against a property of the record. In your rowdatabound event you can hide or show the button in it.

737

Leave a Reply