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

Accessing GridDropDownColumn client

3 Answers 158 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gerry Polami
Top achievements
Rank 1
Gerry Polami asked on 07 Mar 2011, 01:36 PM
<telerik:GridDropDownColumn
              UniqueName="ISHUR" DataField="ISHUR" HeaderText="MyIshur" DropDownControlType="DropDownList"
                   DataSourceID="objdsIshur" ListTextField="Text" ListValueField="Key"/>


Hi All,
I have a radgrid that one of his columns is GridDropDownColumn 
I want to access the GridDropDownColumn in client side  and get the selected index when i move to edit mode.
Note that the DropDownControlType property is set to DropDownList and not to RadComboBox/
Thank,
Gerry

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Mar 2011, 02:41 PM
Hello Gerry,

You can easily achieve this by using the RadComboBox as DropDownControlType. Attach the OnClientLoad for the RadComboBox  like below and access the index value from client side.

aspx:
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
      if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
           GridEditFormItem edititemForCombo = (GridEditFormItem)e.Item;
           GridEditManager editMan = edititemForCombo.EditManager;
           GridDropDownListColumnEditor editor = (GridDropDownListColumnEditor)(editMan.GetColumnEditor("ISHUR"));
           RadComboBox radComboScheduleType = editor.ComboBoxControl;
           radComboScheduleType.OnClientLoad="onClientLoad";
        }
    }

JavaScript:
function onClientLoad(sender, args)
    {
        alert(sender._selectedIndex);
    }

corresponding aspx will be:
<telerik:GridDropDownColumn UniqueName="ISHUR" DataField="ISHUR" HeaderText="MyIshur" DropDownControlType="RadComboBox" DataSourceID="objdsIshur" ListTextField="Text" ListValueField="Key"/>

Thanks,
Shinu.
0
Gerry Polami
Top achievements
Rank 1
answered on 08 Mar 2011, 08:17 AM
Hi,
Thanks but i  want to stay with the DropDownList  as DropDownControlType.
Do you have a solution for it ?
Gerry
0
Tsvetoslav
Telerik team
answered on 11 Mar 2011, 08:43 AM
Hello Gerry,

Attached is a small sample. 

All the best,
Tsvetoslav
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Grid
Asked by
Gerry Polami
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Gerry Polami
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or