简体   繁体   中英

How to get value from dataTable of a column that has a dropdownlist control in the gridview?in row updating event

How can I get the value from data table of the gridview for a specific column where the control is a dropdownlist.So I don't want to get the dropdownlist value I want to get the value for the column that is set in the datatable.

I need it in row updating event

The value in the dbms can only be different if the user has changed it, so either select it from dbms again or - better - use the OldValues Dictionary from GridViewUpdateEventArgs .

void GridView_RowUpdating(Object sender, GridViewUpdateEventArgs e)
{
    String fieldName = "FooColumn";
    Object oldValue = e.OldValues[fieldName];
}

The OldValues property is automatically populated with the original values of all the field name/value pairs in the row. A separate entry is added to the OldValues property for each field in the row.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM