Event of Chech Box in RadListView not working

2 posts, 0 answers
  1. Kumar
    Kumar avatar
    1 posts
    Member since:
    Jun 2012

    Posted 13 Jun 2012 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jun 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top