问题描述
我工作的一个radgrid控件,我想访问其行,但现在看来,这并没有一个 .Rows
属性。
I'm working on a RadGrid, and I want to access its rows but it seems it does not have a .Rows
property.
下面是我曾尝试到现在为止:
Here's what I have tried until now:
如何访问 rgCustomers
的行集?我想一个按钮添加到每一行。
How can I access rgCustomers
's Rows collection? I want to add a button to each row.
推荐答案
根据,
每个动态行中的网格重presents从指定数据源的记录。动态行再由GridDataItem类(的GridItem的后代)psented $ P $。
"Each dynamic row in the grid represents a record from the specified data source. Dynamic rows are represented by the GridDataItem class (a descendent of GridItem).
每个GridTableView有一组类型GridDataItem行(Items集合)的。
Each GridTableView has a set of rows (the Items collection) of type GridDataItem."
所以,你要使用的网格,这是GridDataItems集合的项目集合。
So you want to use the Items collection of the grid, which is a collection of GridDataItems.
protected void btnLoad_Click(object sender, EventArgs e)
{
rgCustomers.DataSource = odsCustomers;
rgCustomers.DataBind();
foreach (GridDataItem row in rgCustomers.Items)
{
}
}
这篇关于获取Telerik的radgrid控件的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!