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

GridClientSelectColumn and onchange event in radgrid GridTemplateColumn

6 Answers 427 Views
Grid
This is a migrated thread and some comments may be shown as answers.
rajesh
Top achievements
Rank 1
rajesh asked on 16 Oct 2014, 08:57 PM
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

6 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 21 Oct 2014, 01:04 PM
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.

 
0
rajesh
Top achievements
Rank 1
answered on 22 Oct 2014, 02:01 PM
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.

0
Kostadin
Telerik team
answered on 27 Oct 2014, 09:32 AM
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.

 
0
Peter
Top achievements
Rank 1
answered on 14 Apr 2015, 12:56 AM
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? 
0
Kostadin
Telerik team
answered on 16 Apr 2015, 01:04 PM
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.

 
0
Jaya
Top achievements
Rank 1
answered on 22 Apr 2015, 06:20 AM

Hi

Admin

Can you solve this 

http://www.telerik.com/forums/how-to-designed-the-aspx-page-and-open-rad-window
Tags
Grid
Asked by
rajesh
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
rajesh
Top achievements
Rank 1
Peter
Top achievements
Rank 1
Jaya
Top achievements
Rank 1
Share this question
or