Access Grid Edit Form template InsertItem & EditItem events from RadDropDownList selectedindexchanged

1 posts, 0 answers
  1. SURYA
    SURYA avatar
    11 posts
    Member since:
    Aug 2014

    Posted 22 Aug 2018 Link to this post

    I have a RadDropDownList in my RadGrid ,which editmode is FormTemplate. When I change RadDropDownList it work good in insert mode but in edit mode it got 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;
              }
          }
Back to Top