int i = e.NewEditIndex;//第i行
string sss = GridView1.Rows[i].Cells[3].Text;//该行第3格的值
string sss = GridView1.Rows[i].Cells[3].Text;//该行第3格的值
解决方案 »
- DW编辑的网页内嵌由屏录专家制作的视频
- 模板里的linkbutton利用JavaScript进行页面跳转到iframe里
- VS2003中,asp.net+sql server 2000的web系统,如何打包?
- datagrid或DataView输出的数据设置背景图
- 有关水晶报表的格式制作问题
- 没分了,水晶报表公式字段的问题
- ~~ 高分 求~~~~项目报价问题!!
- 这个帖子研究好半天了才发出来,请大家指教,呕血作品!只是没有分了!请各位老师帮忙!
- 100分请高人帮我分析分析这个存储过程分页的性能怎么样!
- 大家一起举手!(给csdn出点子!希望csdn越办越好!)
- 学习了.net 到底能开发些什么,有哪些应用领域,接分就来!
- 求助:动态添加的控件如何找到它的事件
{
string index = 根本就没有e.NewEditIndex 这项
}
加层判断
DropDownList dl=(DropDownList)sender;
string id=dl.UniqueID;
//比如DataGrid1:_ctl2:list1 这里ctl2就表示了其行位置
<asp:DropDownList ID="drpGname" runat="server" Index="<%# ((GridViewRow)Container).RowIndex %>" </asp:DropDownList>
自己在前台加Index
后台這樣取(事件里)
DropDownList drp = (DropDownList)sender;
int Index = Convert.ToInt32(drp.Attributes["Index"]);
失望ing...
<asp:TemplateField>
<ItemTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
// .aspx.cs
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList drp = sender as DropDownList;
GridViewRow row = drp.NamingContainer as GridViewRow; // GridView 中对应的行
int id = (int)GridView1.DataKeys[row.RowIndex].Value;
// ...
}