GridClientSelectColumn and onchange event in radgrid GridTemplateColumn

7 posts, 0 answers
  1. rajesh
    rajesh avatar
    6 posts
    Member since:
    Jun 2011

    Posted 16 Oct 2014 Link to this post

    I have a Radgrid with following items in a row-

    GridClientSelectColumn
    Several Template column Text Box
    Few Template column RadDatePicker

    On the client side I want to check "GridClientSelectColumn- checkbox " when a user changes value ( Onchange event ) in the template columns ( textbox/Date field )

    How do I achieve it on the client side for multiple controls ( textbox/Date field )

    thanks
  2. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 21 Oct 2014 Link to this post

    Hi Rajesh,

    A possible solution is to use get_selectedItems client function which returns all selected items of the grid. Please check out the following code snippet.
    function GetSelected() {
        var dataItems = $find("RadGrid1").get_masterTableView().get_selectedItems();
    }

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rajesh
    rajesh avatar
    6 posts
    Member since:
    Jun 2011

    Posted 22 Oct 2014 in reply to Kostadin Link to this post

    Hi Kostadin,

    Thank  you for your response.
    What I am interested in is different.

    What I was interested in is that

    -when I change the value of a textbox ( One of the template column ) in the radgrid, the corresponding row's checkbox from  GridClientSelectColumn get checked.

  5. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 27 Oct 2014 Link to this post

    Hi Rajesh,

    A possible solution is to hook onchange client event of the TextBox and pass the row index as an argument. This way you will be able to find the row which TextBox is changed and select it. For your convenience I prepared a small sample and attached it to this thread.

    Regards,
    Kostadin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Peter
    Peter avatar
    98 posts
    Member since:
    Mar 2012

    Posted 13 Apr 2015 in reply to Kostadin Link to this post

    I'm trying to do this with a RadComboBox inside a template column, but the OnChange event of the Combo Box doesn't seem to fire? 
  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 16 Apr 2015 Link to this post

    Hello Peter,

    Note that RadTextBox does not have a OnChange event and you have to use OnClientSelectedIndexChanged. Please check out the following code snippet.
    C#:
    protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = e.Item as GridDataItem;
            RadComboBox comboBox = item["TemplateColumn"].FindControl("RadComboBox1") as RadComboBox;
            comboBox.OnClientSelectedIndexChanged = "function(s,a){SelectRow(s,a,'" + item.ItemIndex + "');}";
        }
    }
    JavaScript:
    <script type="text/javascript">
        function SelectRow(sender, args, index) {
            var grid = $find('<%= RadGrid1.ClientID %>');
            grid.get_masterTableView().get_dataItems()[index].set_selected(true)
        }
    </script>


    Regards,
    Kostadin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  8. Jaya
    Jaya avatar
    81 posts
    Member since:
    Mar 2011

    Posted 22 Apr 2015 in reply to Kostadin Link to this post


    Hi

    Admin

    Can you solve this 

    http://www.telerik.com/forums/how-to-designed-the-aspx-page-and-open-rad-window
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017