c# - Get value from GridView -


i trying value gridview , save session variable.

i know column name , there ever 1 value in gridview. best way select , save session variable?

the column name customerid , value int.

if there 1 column , 1 row in gridview can try below.

session["mysessionvalue"]=  gridview1.rows[0].cells[0].text; 

but exception can thrown when access index if there no records in gridview. better check gridview1.rows.count first , value


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -