如何在网格中的运行时将数据添加到特定列

时间:2010-12-09 18:17:09

标签: asp.net .net-3.5 grid telerik asp.net-3.5

I have a rad grid, i have bounded the columns in the grid using GripBoundColumns which shows me dropdown cloumns when i edit the record, Insert/update/delete are working fine for me.


My question is it possible to insert new data into the column(Not the whole record just only to one column) when i edit the record.

For example...

suppose i have 5 columns (Client Name, Account No, Account name, account status, Custodian Dealer)

CustodianDealer is my drop down coloumn and data for it comes from different table

when i edit or insert a new record in the grid, i can select the existing Custodiandealers in the table.

now if i want to insert a new record to the custodianDealer table not to the grid, how can i acheive it

3 个答案:

答案 0 :(得分:0)

在ItemDataBound事件中尝试这样的事情:

If TypeOf (e.Item) Is GridDataItem Then
    Dim GDI As GridDataItem = CType(e.Item, GridDataItem)

    GDI([ColumnNameAsString]).Text = "Some custom text"
End If

GridDataItem本质上是一个TableCell,因此您可以根据需要添加控件。

哦,如果我的注释不清楚,“[ColumnNameAsString]”是你自己的列名。

答案 1 :(得分:0)

连接网格插入命令并执行插入查询,该查询仅使用新条目更新Custodiandealers表。要在下拉列表编辑器中显示它,请确保新记录与网格主表源具有外部关系,作为Custodiandealers表中的其余项目。

答案 2 :(得分:0)

因此,如果我正确地阅读您的问题,您将尝试根据编辑/插入期间所做的某些更改将记录插入custodianDealer表。

如果是这种情况,您可以处理ItemCommand事件并根据这些更改更新数据表。

您能否提供用例的确切详细信息?