c# - get a column data from a gridview -


i have generated event of button field index of row couldn't content of column
me please can use select query in pass index of row (i don't know how write condition in clause)

protected void gridview1_rowcommand(object sender, gridviewcommandeventargs e)      {              if (e.commandname == "affichediplome") {              int index = convert.toint32(e.commandargument);              gridviewrow row = gridview1.rows[index];              int serverid = convert.toint32(gridview1.datakeys[index].value); messagebox.show(index.tostring());           }     }  

try this..

add bound filed store information not want show user have use @ server side.

<asp:datagrid gridlines="none"  id="dg" autogeneratecolumns="false" runat="server" borderstyle="none"> <columns>     <asp:boundcolumn datafield="id" visible="false"></asp:boundcolumn>     <asp:templatecolumn headertext="sr. no."  itemstyle-width="5%">     </asp:templatecolumn> </columns> <asp:boundcolumn datafield="modulename" headertext="module name"> </asp:boundcolumn> </asp:datagrid> 

then @ server side can data follows.

private sub dg_itemdatabound(byval sender object, byval e system.web.ui.webcontrols.datagriditemeventargs) handles dgwebinardata.itemdatabound dim str string = string.empty str = e.item.cells(1).text end sub 

note: e.item.cells(1) give id if , if when id first column of grid, else provide column number.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -