|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A program about get value from datagrid cellHi,all
I have a asp.net programme,and it include a datagrid contorl in it.And all the data from the datagrid is come from a access mdb.And I had use like <$#DataBinder.Eval(Containter.DataItem,"name")%> to binding data. And in this datagrid control there is a delete command , when I active this command I want to get the value of column 2 in this row and the visable of this column is false.How can I get it? I had try the code like this,but can't get any value . private int DataGrid1_DeleteCommand(object source,DataGridCommandEventArgs e){ int i=e.Item.Cells[1].Text; } How can I get the select cell's value in current selected row? Hi!
You can get all the value directly from the dataSource table... If you felt datagrid with a datatable, you can write this on your "del event": DataTable dt = (DataTable)yourDataGrid.dataSource; int itemId = e.Item.ItemIndex + (yourDataGrid.CurrentPageIndex * yourDataGrid.PageSize); int i = dt[itemId]["id"]; now you have all the records... hidden too!!! bye Melk Show quoteHide quote "Jet" <liang***@126.com> ha scritto nel messaggio news:uTt9xFxcFHA.2736@TK2MSFTNGP12.phx.gbl... > Hi,all > I have a asp.net programme,and it include a datagrid contorl in it.And all > the data from the datagrid is come from a access mdb.And I had use like > <$#DataBinder.Eval(Containter.DataItem,"name")%> to binding data. And in > this datagrid control there is a delete command , when I active this > command I want to get the value of column 2 in this row and the visable of > this column is false.How can I get it? > I had try the code like this,but can't get any value . > private int DataGrid1_DeleteCommand(object source,DataGridCommandEventArgs > e){ > int i=e.Item.Cells[1].Text; > } > How can I get the select cell's value in current selected row? > Sorry I wrote :
int i = dt[itemId]["id"]; but I mean : int i = dt.Rows[itemId]["id"]; Show quoteHide quote "Jet" <liang***@126.com> ha scritto nel messaggio news:uTt9xFxcFHA.2736@TK2MSFTNGP12.phx.gbl... > Hi,all > I have a asp.net programme,and it include a datagrid contorl in it.And all > the data from the datagrid is come from a access mdb.And I had use like > <$#DataBinder.Eval(Containter.DataItem,"name")%> to binding data. And in > this datagrid control there is a delete command , when I active this > command I want to get the value of column 2 in this row and the visable of > this column is false.How can I get it? > I had try the code like this,but can't get any value . > private int DataGrid1_DeleteCommand(object source,DataGridCommandEventArgs > e){ > int i=e.Item.Cells[1].Text; > } > How can I get the select cell's value in current selected row? >
Webform Navigation
Can't set button to Visible? databind - XmlNodeList to DropDownList Need reviews and advice on web and data control tools and vendors Is someone willing to help me with a simple VB example? custom web controls and conversion to inline code DataGrid NOT Paging Web Custom Control using a property displaying current form text boxes Reach UserControl from ASPX codebehind? Dynamically populating and expanding TreeView from button click... |
|||||||||||||||||||||||