Radgrid FormTemplate 内的 Radcombobox
天哪,
我在 RadGrid 中有一个 RadComboBox 控件,当 InitInsert 操作发生时会显示该控件。我使用实体框架作为数据源&其中包含的结果是正确的。我的问题是,当我使用 findcontrol 时它什么也不返回。
如果 e.CommandName = "InitInsert" 那么 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 而不是编辑表单的任何答案。我缺少什么? :-(
谢谢。
G'day,
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.
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>
I'm having trouble finding any answers that reference FormTemplate without it being an edit form. What am I missing? :-(
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我面前没有电脑来测试它,但我很确定:
1)你没有看到正确的控件集合
2) 或 RadComboBox 尚未创建或已创建但 ID 不匹配
所以你找不到它
,也不是100%确定。也许这可以帮助您它的完整示例: http:// /beecy.net/post/2009/01/07/telerik-radgrid-formtemplate-codebehind.aspx (也许可以根据此检查您的标记)
I don't have my computer in front of me to test it but I'm pretty sure that either:
1) You are not looking at the right controls collection
2) or the RadComboBox is not create yet or has been created but the ID doesn't match
so you cannot find it
Again not 100% sure. Maybe this can help you its a complete example: http://beecy.net/post/2009/01/07/telerik-radgrid-formtemplate-codebehind.aspx (maybe check you markup against this one)
我的问题是通过使用 ItemCreated 命令解决的。可以在此处找到示例:
http://www.telerik.com/community/forums/aspnet-ajax/grid/find-controls-when-using-editcommand.aspx
我的情况的代码是:
My problem was solved by using an ItemCreated command. An example can be found here:
http://www.telerik.com/community/forums/aspnet-ajax/grid/find-controls-when-using-editcommand.aspx
The code for my situation was: