I have a telerik RadDropDownList in my telerik RadGrid, whose editmode is FormTemplate. When I change RadDropDownList it work good in insert mode but in edit mode it got error.
InvalidCastException = "Unable to cast object of type 'Telerik.Web.UI.GridEditFormItem' to type 'Telerik.Web.UI.GridEditFormInsertItem'."
protected void TransactionTypeTextBox_SelectedIndexChanged(object sender, DropDownListEventArgs e)
{
RadDropDownList dropdownlist1 = (RadDropDownList)sender;
GridEditFormInsertItem item = (GridEditFormInsertItem)dropdownlist1.NamingContainer;
Panel Panel1 = (Panel)item.FindControl("Panel1");
if (dropdownlist1.SelectedItem.Text == "Cheque")
{
Panel1.Visible = true;
}
else if (dropdownlist1.SelectedItem.Text == "Cash")
{
Panel1.Visible = false;
}
}
由于GridEditFormInsertItem是从GridEditFormItem派生的,因此以下两种情况都适用。
GridEditFormItem item = (GridEditFormItem)dropdownlist1.NamingContainer;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.