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

[Solved] CommandItemTemplate Controls in javascript.

1 Answer 209 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shrirang
Top achievements
Rank 1
Shrirang asked on 04 Jun 2009, 10:43 AM
Hi,
         I am using command item template in radgrid.
In my command item template i am using Radcombobox.
I set 

CommandItemDisplay

="TopAndBottom"

on both sides
RadCombobox conatins various items
Eg "DELETE"
     "Convert"
    "Add to Cart"
When i select any item from combo it sholud be reflect in both the top and bottom combos.
when i select "Delete"  from top combo ,bottom combo should also display "Delete"

How can i access the same combos in javascript differently.
So that i can change their value on their 

 

OnClientSelectedIndexChanged event.
Or Is their any way to do that?
Please let me know as soon as possible.
Thanks

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Jun 2009, 11:46 AM
Hello Shrirang,

You can try out the following code to change the selected item on bottom CommandItemTemplate combobox on the SelectedIndexChanged event of the top CommandItemTemplate combobox:
c#:
  protected void RadGrid_ItemCreated(object sender, GridItemEventArgs e) 
    { 
         GridCommandItem commandItem = (GridCommandItem)RadGrid.MasterTableView.GetItems(GridItemType.CommandItem)[0]; 
            if (commandItem.NamingContainer is GridTHead) 
            { 
                ((RadComboBox)commandItem.FindControl("RadComboBoxID")).SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(_Default_SelectedIndexChanged); 
 
            }      
    } 
 
    void _Default_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) 
    { 
        RadComboBox combo = (RadComboBox)o; 
        GridCommandItem commandItem = (GridCommandItem)RadGrid.MasterTableView.GetItems(GridItemType.CommandItem)[1]; 
        if (commandItem.NamingContainer is GridTFoot) 
        { 
            ((RadComboBox)commandItem.FindControl("RadComboBoxID")).SelectedIndex = combo.SelectedIndex; 
 
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Shrirang
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or