radcombobox控件radgrid控件FormTemplate内 [英] Radcombobox inside Radgrid FormTemplate

查看:351
本文介绍了radcombobox控件radgrid控件FormTemplate内的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

儿真好,

我有当InitInsert动作发生时显示的radgrid控件内部的radcombobox控件控制。我使用实体框架作为数据源和放大器;包含在此的结果是正确的。我的问题是,当我使用的FindControl它没有返回值。

I have a RadComboBox control inside of a RadGrid that is displayed when the InitInsert action occurs. I'm using Entity Framework as a datasource & the results contained within this are correct. My problem is that when I use findcontrol it returns nothing.

如果e.CommandName =InitInsert然后
            RadGrid1.MasterTableView.InsertItemDisplay = Telerik.Web.UI.GridInsertItemDisplay.Bottom
            昏暗的查询=从myTable的在dbEntity.myTables选择myTable.Name,myTable.ID

If e.CommandName = "InitInsert" Then RadGrid1.MasterTableView.InsertItemDisplay = Telerik.Web.UI.GridInsertItemDisplay.Bottom Dim query = From myTable In dbEntity.myTables Select myTable.Name, myTable.ID

        Dim mineCompBox = CType(e.Item.FindControl("mineCompBox"), RadComboBox)
        mineCompBox.DataSource = mineCompQuery
        mineCompRadBox.DataTextField = "Name"
        mineCompRadBox.DataValueField = "Id"
        mineCompRadBox.DataBind()</code>

我无法找到引用FormTemplate没有它编辑表单任何答案。我在想什么? : - (

I'm having trouble finding any answers that reference FormTemplate without it being an edit form. What am I missing? :-(

感谢。

推荐答案

我的问题是通过使用ItemCreated命令解决。一个例子可以在这里找到:

My problem was solved by using an ItemCreated command. An example can be found here:

<一个href=\"http://www.telerik.com/community/forums/aspnet-ajax/grid/find-controls-when-using-editcommand.aspx\" rel=\"nofollow\">http://www.telerik.com/community/forums/aspnet-ajax/grid/find-controls-when-using-editcommand.aspx

在code我的情况是:

The code for my situation was:

Private Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
    If TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode Then
        Dim dbEntity As WebsiteEntities = New WebsiteEntities
        Dim myQuery = From myTable In myTables Select myTable.Name, myTable.ID
        Dim EditFormItem As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
        Dim myCombobox As RadComboBox = DirectCast(EditFormItem.FindControl("radDropBox"), RadComboBox)
        myCombobox.DataSource = myQuery
        myCombobox.DataTextField = "Name"
        myCombobox.DataValueField = "ID"
        myCombobox.DataBind()
    End If
End Sub

这篇关于radcombobox控件radgrid控件FormTemplate内的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆