Need to implement dropdown contain check box value and after selecting save immediately

2 posts, 0 answers
  1. Samir Patel
    Samir Patel avatar
    54 posts
    Member since:
    Jul 2009

    Posted 26 Apr 2011 Link to this post


    I have implemented one drop down in the Grid , and this drop down contain the values with check box, so that user can select multiple value from drop down, and i want to save once i lost the focus from this drop down, and the selected values are displayed in the other column of the same grid..

    Let me know how can i do this?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Apr 2011 Link to this post

    Hello Samir,

    You could achieve this by attaching OnClientDropDownClosing to the RadComboBox. Here is a sample code to achieve the same.
    Client side:
    function OnClientDropDownClosing(sender, args)
            var comboBox = sender;
            var grid = $find("<%=RadGrid1.ClientID %>");
            var MasterTable = grid.get_masterTableView();
            var items = comboBox.get_items();
            for (var i = 0; i < items.get_count(); i++)
                if (items.getItem(i).get_element().innerHTML.indexOf("CHECKED") > 0) //checking whether the item is selected or not
                    var index = comboBox.get_attributes().getAttribute("Index");//index of the corresponding row which is set from ItemCreated event of the RadGrid.
                    var row = MasterTable.get_dataItems()[index]; //accessing the row
                    var cell = MasterTable.getCellByColumnUniqueName(row, "ColumnUniqueName");
                    cell.innerText += items.getItem(i).get_text();

    Attach the ItemCreated event to the RadGrid and add the Corresponding rowIndex as attribute as shown below.
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
       if (e.Item is GridDataItem)
              GridDataItem item = (GridDataItem)e.Item;
              RadComboBox combo = (RadComboBox)item.FindControl("RadCombo1");
              combo.Attributes.Add("Index", e.Item.ItemIndex.ToString());

Back to Top