如何在动态网格视图中获取当前行值 [英] How to get current row value in Dynamic gridview
问题描述
嗨
这里我的问题是我不知道如何在动态gridview中获取当前行值,
i请参考此链接
动态添加和删除行ASP.NET GridView [ ^ ]
例如:
这里我使用动态gridview,用户可以在gridview中添加和删除更多行,每行我使用列名(数量),如果客户端总共添加两行并且他们点击第一行图像(imagebutton)我想显示弹出他们输入的是什么数量栏,它类似第二排,
怎么做..
谢谢!
您可以使用GridView1.SelectedRow
属性OnSelectedIndexChanged
事件发生在GridView
检查以下教程
http://aspsnippets.com/Articles/How-to-get-Selected-Row-cell-value-from-GridView-in-ASPNet.aspx [ ^ ]
您可以为ImageButton
指定CommandName
属性。
同样声明CommandArgument
属性如...
CommandArgument =<%#((GridViewRow)容器).RowIndex%>
然后在<$ c $里面c> RowCommand 事件,检查CommandName
并获取行的详细信息,如...
int index = Convert.ToInt32(e.CommandArgument);
// 检索包含点击按钮的行
用户从Rows集合中 // 。
GridViewRow row = ProductsGridView.Rows [index];
完整示例 - GridView.RowCommand Event [ ^ ]
Hi
Here my problem is i don't know how to get current row value in dynamic gridview,
i refer this link
Dynamically adding and deleting rows from ASP.NET GridView[^]
For Example:
here i using dynamic gridview, user can add and remove more row in gridview, each row i use column name(quantity), if client add totally two rows and they click first row image(imagebutton) i want to show popup what they are enter in no of quantity column, it similar like second row,
how to do that..
Thank You !
You can useGridView1.SelectedRow
property whenOnSelectedIndexChanged
event occures in theGridView
Check below tutorial
http://aspsnippets.com/Articles/How-to-get-Selected-Row-cell-value-from-GridView-in-ASPNet.aspx[^]
You can have aCommandName
property specified for theImageButton
.
Also declareCommandArgument
property like...
CommandArgument="<%# ((GridViewRow) Container).RowIndex %>"
Then inside theRowCommand
Event, check theCommandName
and get the details of the Row like...
int index = Convert.ToInt32(e.CommandArgument); // Retrieve the row that contains the button clicked // by the user from the Rows collection. GridViewRow row = ProductsGridView.Rows[index];
Complete example at - GridView.RowCommand Event[^]
这篇关于如何在动态网格视图中获取当前行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!