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

Need help: GridClientSelectColumn checked on DropDown column SelectedIndexChanged

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Hunter
Top achievements
Rank 1
Hunter asked on 31 Jan 2014, 05:36 PM
I have 2 columns:

1. GridClientSelectColumn with a unique name of cCheckBox
2. GridTemplateColumn with a dropdown list in it, with a unique name of cDropDownList

If the DropDownList for a row changes value I need to automatically put a check in the checkbox of the same row.

So far I did the following:
for my ddl I added the following properties:
OnSelectedIndexChanged="ddlRegistryStatus_SelectedIndexChanged" AutoPostBack="True
in my code behind:
I created a sub:
Protected Sub ddlRegistryStatus_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)

End Sub

I don't know what to do from here. It would also be nice if I could Ajaxify this whole thing.






1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Feb 2014, 04:34 AM
Hi Hunter,

Please try the following code snippet to set the GridClientSelectColumn to checked mode on the DropDownList selected index change:

ASPX:
<telerik:GridClientSelectColumn UniqueName="cCheckBox">
</telerik:GridClientSelectColumn>
<telerik:GridTemplateColumn HeaderText="DropDownList">
    <ItemTemplate>
        <asp:DropDownList ID="cDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="cDropDownList_SelectedIndexChanged">
        </asp:DropDownList>
    </ItemTemplate>
</telerik:GridTemplateColumn>

C#:
protected void cDropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
 DropDownList drop=(DropDownList)sender;
 GridDataItem item=(GridDataItem)drop.NamingContainer;
 CheckBox check = (CheckBox)item["cCheckBox"].Controls[0]; //Accessing CheckboxColumn using the UniqueName
 check.Checked = true;
 item.Selected = true;
}

You can Ajaxify the Grid as follows:

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
   <AjaxSettings>
      <telerik:AjaxSetting AjaxControlID="RadGrid1">
        <UpdatedControls>
          <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
        </UpdatedControls>
      </telerik:AjaxSetting>
    </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
    <telerik:RadGrid ID="RadGrid1" runat="server"..../>

Thanks,
Princy
Tags
Grid
Asked by
Hunter
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or