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

How to add combobox on radgrid?

2 Answers 104 Views
Grid
This is a migrated thread and some comments may be shown as answers.
GarryP
Top achievements
Rank 1
GarryP asked on 02 Apr 2009, 09:31 AM
Hi,

Is there a way of adding a combo box  rather than an image or link button in radgrid. If there is then would it enable so that a user selects a certain item in combobox and it does what is wanted like in ItemCommand of Image or link button.

Thanks

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Apr 2009, 10:24 AM
Hi GarryP,

One suggestion will be to fire the ItemCommand from the OnClientSelectedIndexChanged event of the RadComboBox.

ASPX:
 
 
<CommandItemTemplate> 
                   <telerik:RadComboBox ID="RadComboBox1" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" runat="server"
                     <Items> 
                      <telerik:RadComboBoxItem  Text="Command1" /> 
                       <telerik:RadComboBoxItem  Text="Command2" /> 
                     </Items> 
                  </telerik:RadComboBox> 
               </CommandItemTemplate> 

JS:
 
 
<script type="text/javascript" > 
 
function OnClientSelectedIndexChanged(sender,args) 
 
  var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();  
  masterTable.fireCommand(sender.get_text(),"");  
 
</script> 

CS:
 
 
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
    { 
        if (e.CommandName == "Command1"
        {  
         
        } 
        else if (e.CommandName == "Command2"
        {  
         
        } 
    } 
 


Regards
Shinu.




0
asif rehman
Top achievements
Rank 1
Iron
answered on 01 Jul 2017, 12:53 PM

hi shinu...

This is the simplest method to fire ItemCommand event via the ComboBox but this code is not working at my end.I would be glad if you can send me the zipped file of the running example or can recommend the similar articles as Iwant to accomplish the same functionality. 

Tags
Grid
Asked by
GarryP
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
asif rehman
Top achievements
Rank 1
Iron
Share this question
or