Wednesday, September 26, 2012

How to make a CheckBoxList Items as a HyperLink

.aspx code

 <script type="text/javascript">
function test() {

<asp:CheckBoxList ID="chkEvents" runat="server" RepeatLayout="Table" RepeatColumns="3" CellPadding="10" CellSpacing="10" RepeatDirection="Horizontal">
<asp:ListItem Text=" Join Us " Value="0">
<asp:ListItem Text=" Earnings " Value="1">                     </asp:ListItem>
 <asp:ListItem Text=" Redemption " Value="2"></asp:ListItem>

.aspx.cs code

foreach (ListItem chk in chkEvents.Items)
   if (chk.Selected)

     chk.Text = " <a href='javascript:test();'>" + chk.Text +   "</a>";


//using javascript method in href   --- chk.Text = " <a href='javascript:test();'>" + chk.Text + "</a>";
and also we can call script from anchor tag in the above example.

No comments:

Post a Comment



Custom Search
Protected by Copyscape Plagiarism Software