c# - Using DataGrid ItemDataBound Event to Check Value -


i've got datagrid datasource bound sqldatareader object:

  sqldatareader areader = runner.reader;   dgsearchresults.datasource = areader;   dgsearchresults.databind(); 

i've created itemdatabound event grid , want check value of specific column/cell while each item bound can enable/disable flags.

how can value of specific cell "svcid" on itemdatabound?

here code:

 public void dgsearchresults_itemdatabound(object sender,  datagriditemeventargs e)     {          if (viewstate["svcids"] != null)         {             if (e.item != null)             {                 var svcids = (list<int>) viewstate["svcids"];                  if (svcids.contains(convert.toint32(**datagrid svcid goes here**))                 {                     //todo: enable/disable icons                 }             }         }     } 

i've used rowdatabound events before not datagrid control, , required steps bit different seems.

what code check value of column "svcid" in datagrid against svcids (using index) list?

thanks

you can use following access cells:

e.item.cells[index].text; 

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datagriditemeventargs.item.aspx


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -