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

Event of Chech Box in RadListView not working

1 Answer 89 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Kumar
Top achievements
Rank 1
Kumar asked on 13 Jun 2012, 10:06 AM
Hi All,

 I  have RadListView  having some data .I want to do some operation in the code behind when the checkbox in the listview is checked
 I have the code as below

<telerik:RadListView ID="lstViewSelectedContact" runat="server" ItemPlaceholderID="pnlItemholder"
                                    OnSelectedIndexChanged="listView_SelectedIndexChanged"  Width="600px"  OnPreRender = "lstViewSelectedContact_OnPreRender"
                                    AllowMultiItemSelection="true" DataKeyNames="id"  Visible="true"   
                                    OnNeedDataSource="lstViewSelectedContact_NeedDataSource"
                                    onitemcommand="lstViewSelectedContact_ItemCommand"  >
                                    <LayoutTemplate>
                                        <asp:Panel ID="pnlItemholder" runat="server" Height="100px"></asp:Panel>
                                    </LayoutTemplate>
                                    <ItemTemplate>
                                        <span>
                                            <asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true"   OnCheckedChanged="chkSelect_OnCheckedChanged" BackColor="Transparent" BorderStyle="None" Text='<%#Eval("text") %>'>                                                   
                                            </asp:CheckBox>                                       
                                        </span>                                     
                                    </ItemTemplate>
                                    <SelectedItemTemplate>
                                        <asp:CheckBox ID="chkSelectedItem" runat="server" AutoPostBack="true" BackColor="LightSkyBlue" BorderStyle="None" CommandName="Deselect" Text='<%#Eval("text") %>'>
                                                   
                                        </asp:CheckBox>                                     
                                      
                                    </SelectedItemTemplate>                                   
                                    <ItemSeparatorTemplate>
                                        <span style="color: Black; font-weight: normal;"></span>
                                    </ItemSeparatorTemplate>
                                </telerik:RadListView>


The Problem is that I cant get the checked items(ID and value) in the code behind ie in chkSelect_OnCheckedChanged event.
Thanks
 Kumar

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2012, 12:28 PM
Hi Kumar,

Try the following code to get the value of the CheckBox in code behind.

C#:
protected void chkSelect_OnCheckedChanged(object sender, EventArgs e)
    {
        CheckBox chk = (CheckBox)sender;
        Response.Write(chk.Text);
    }

Hope this helps.

Thanks,
Shinu.
Tags
ListView
Asked by
Kumar
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or