让我说我有这个网格,
<telerik:RadGrid
...........................
...........................
<FormTemplate>
<asp:TextBox ID="txtDescription" runat="server" />
</FormTemplate>
...........................
...........................
...........................
现在在代码背后我需要在DataSource1_Updating事件中使用txtDescription,
protected void DataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e){
这可能吗?
答案 0 :(得分:1)
以下是我修复此问题的方法。定义了一个EditCommand,
protected void RadGrid1_EditCommand(object sender, GridCommandEventArgs e)
{
ViewState["CurrentIndex"] = e.Item.ItemIndex;
}
在我的活动中,
protected void DataSource1_Updating(object sender, SqlDataSourceCommandEventArgs e){
var currentIndex = (int)ViewState["CurrentIndex"];
var form = RadGrid1.Items[currentIndex].EditFormItem;
var txtDescription= form.FindControl("txtDescription") as RadComboBox;