How to add combobox on radgrid?

3 posts, 0 answers
  1. GarryP
    GarryP avatar
    18 posts
    Member since:
    Feb 2007

    Posted 02 Apr 2009 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 02 Apr 2009 Link to this post

    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.




  3. asif rehman
    asif rehman avatar
    7 posts
    Member since:
    Jul 2014

    Posted 01 Jul 2017 in reply to Shinu Link to this post

    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. 

Back to Top