how to select all items at a time in CheckBoxList

Posted by Mahesh_Chs under ASP.NET on 10/19/2012 | Points: 10 | Views : 7309 | Status : [Member] | Replies : 3
hii

i have a CheckBoxList and a link button, if i press link button i want to check all items in the CheckBoxList

Thank you
Regards
Mahesh chayanam




Responses

Posted by: Gow.Net on: 10/19/2012 [Member] Starter | Points: 25

Up
0
Down
hi refer this link http://www.dotnetcurry.com/ShowArticle.aspx?ID=77

gowthaman8870226416

Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vasanthmvp on: 10/19/2012 [Member] Starter | Points: 25

Up
0
Down

Posted by: Jayakumars on: 10/20/2012 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title></title>

</head>

<body>

<form id="form1" runat="server">

<asp:CheckBoxList ID="chk1" runat ="server" >

<asp:ListItem Text ="Jesus"></asp:ListItem>

<asp:ListItem Text ="Bible"></asp:ListItem>

</asp:CheckBoxList>



<asp:LinkButton ID="lnk1" runat ="server" Text ="Click" onclick="lnk1_Click">

</asp:LinkButton>



</form>

</body>

</html>


Server Side

protected void lnk1_Click(object sender, EventArgs e)

{

for(int i=0;i<=chk1.Items.Count-1;i++)

{

chk1.Items.Selected=true;

}

}


Mark as Answer if its helpful to you

Mahesh_Chs, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response