anjali khan

anjali khan

  • NA
  • 293
  • 66.6k

how to create label and 2 chkbox in custom control in asp.ne

Sep 19 2015 1:21 AM
how to create 1 label and 2 checkbox in custom control in asp.net?
  i created the below code in aspx page ...
 
but i want to use  custom control...how to make it custom control in asp.net ?
 
please send me step by step...
i seen in net by i didnt understand..
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function fncheck(me) {
me.checked = true;
var chkary = document.getElementsByTagName('input');
for (i = 0; i < chkary.length; i++) {
if (chkary[i].type == 'checkbox') {
if (chkary[i].id != me.id)
chkary[i].checked = false;
}
}
}

</script></head>
<body>
<form id="form1" runat="server">
<h3 style="font-size:larger; color:Maroon">
User Control</h3>
<div style="width: 100%; text-align: center">
<table style="width: 33%; background-color: Silver; height: 98px;">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Some Text" ForeColor="Blue"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:CheckBox ID="chkyes" Text="Yes" runat="server" AutoPostBack="true" onclick="fncheck(this)" />
&nbsp;&nbsp;
<asp:CheckBox ID="chkno" Text="No" runat="server" AutoPostBack="true" onclick="fncheck(this)" />
</td>
</tr>
</table>

</div>
</form>
</body>
</html>

Answers (2)