【问题标题】:how to add data into a specific column at runtime in grid如何在运行时在网格中将数据添加到特定列中
【发布时间】:2011-05-23 01:06:58
【问题描述】:
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

【问题讨论】:

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


    【解决方案1】:

    在 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]”是您自己的列名。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

      • 你能给我一个小例子吗
      【解决方案3】:

      所以,如果我正确阅读了您的问题,您正试图根据编辑/插入期间所做的一些更改将记录插入到 custodianDealer 表中。

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

      您能否提供用例的确切细节?

      【讨论】:

      • 用户在运行时可能需要添加或编辑新的托管交易商
      • 如果您不提供有关问题的更详细信息,这将很难帮助您解决问题。您能否提供一些关于如何添加新 custodianDealer 的 cmet 的 UI 屏幕截图?它会从网格中添加吗?来自网格外的另一个表单域?听起来列表是一个下拉列表,那么您是否使用 Telerik ComboBox 允许在字段中输入文本?请尽可能具体,这将帮助您更快地得到答案。
      猜你喜欢
      • 1970-01-01
      • 2014-06-02
      • 1970-01-01
      • 2012-10-07
      • 2014-07-28
      • 2011-04-07
      • 2011-10-16
      • 1970-01-01
      • 2011-11-30
      相关资源
      最近更新 更多