This is a migrated thread and some comments may be shown as answers.

reference controls in insert form

3 Answers 127 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 2
Iron
Iron
Iron
Morten asked on 13 May 2008, 10:22 PM
In a rg:
  <telerik:RadGrid ID="rg" runat="server">
    <MasterTableView DataKeyNames="FormId" CommandItemDisplay="Top" EditMode="InPlace">
      <Columns>
I have two <telerik:GridTemplateColumn... />. One with a checkbox and the other with a dropdownlist inside the <EditItemTemplate>.

How do I access controls inside the <EditItemTemplate> of a GridTemplateColumn when the "Insert new record" button in the CommandItem (I like to load the dropdown list and set checked on the checkbox)?

I can access the controls from the ItemDataBound RadGrid event (Case GridItemType.EditItem). I this is the place, how do I then distinguish between EditMode and InsertMode?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 May 2008, 05:19 AM
Hi Morten71,

Try accessing the control during the Insert mode in the ItemDataBound event as shown below.

CS:
 protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
     { 
         if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted))  
         { 
             GridEditFormInsertItem InsertItem = (GridEditFormInsertItem)e.Item; ; 
             DropDownList ddl = (DropDownList)InsertItem["columnUniqueName"].FindControl("DropDownList1"); 
         }  
    } 


Thanks
Shinu
0
Morten
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 May 2008, 12:26 PM
if I instead of testing for type GridEditFormInsertItem test for type GridDataInsertItem I can access the controls
0
Princy
Top achievements
Rank 2
answered on 15 May 2008, 07:53 AM

Hi,

You can also refer the following help document link.
Accessing cells and rows

Princy

Tags
Grid
Asked by
Morten
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Shinu
Top achievements
Rank 2
Morten
Top achievements
Rank 2
Iron
Iron
Iron
Princy
Top achievements
Rank 2
Share this question
or