18
Reply

how to chk or unchk using images in asp.net?

anjali khan

anjali khan

Jan 5 2016 12:43 AM
507
hi frnds,
 
i wants to display using image button click, my code is working but again if i click on checked image so it is not coming in unchk condition....
this is my code
design page
<div>
<asp:CheckBox ID="chkbox1" runat="server" Style="display: none" AutoPostBack="True" BackColor="Gray" OnCheckedChanged="chkbox1_CheckedChanged1" />
<label for="chkbox1">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/checkbox_unchecked.png" AutoPostBack="True" OnClick="ImageButton1_Click"/>

</label>
</div> 
 
code////
 
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
ImageButton1.ImageUrl = "~/Images/checkbox_checked.png"; 
}

Answers (18)