Click here to Skip to main content
15,907,497 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am working on web application and using DataList Control to show data.

I have placed a checkbox (along with disabled Radio buttons) in ItemTemplate of Data List. I want that when I click on checkbox those Radio Button become enable.

How its possible?

Regards!
Aman
Posted
Comments
[no name] 27-May-11 8:37am    
post what you have done so far, let us take a look and correct the mistake

You can do it using JQuery. Below is what I did:

<script type="text/javascript" src="jquery-1.6.js"></script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript" language="javascript">
function SelectRBTN(chk)
{
$('#<%=dataList.ClientID %>').find("input:checkbox").each(function() {
if (this == chk && this.value == 'on') {
$(this).parent('td').children('input:radio').attr('disabled', '');
}
});
}
</script>
</head>
<body >
<form id="form1" runat="server">
<asp:DataList ID="dataList" runat="server"
onitemcreated="dataList_ItemCreated" >
<ItemTemplate>
<asp:CheckBox ID="chk" runat="server" onclick="javascript:SelectRBTN(this);"/>
<asp:RadioButton ID="rbtn1" runat="server" enabled="false" />
<asp:RadioButton ID="rbtn2" runat="server" enabled="false" />
<%#Eval("Name") %>
<%#Eval("Roll")%>
</ItemTemplate>
</asp:DataList>
</form>
</body>
</html>
 
Share this answer
 
on event ItemDataBound find the controls and modify there properties

see this[^] it maight help;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900