Skip to content

Instantly share code, notes, and snippets.

@A2H111
Created July 12, 2017 23:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save A2H111/5a859c160d39b437e997a51a408ac9e3 to your computer and use it in GitHub Desktop.
Save A2H111/5a859c160d39b437e997a51a408ac9e3 to your computer and use it in GitHub Desktop.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
<script type="text/javascript">
$(document).ready(function () {
//Attach change event to radiobuttonlist controls
$("input:radio").change(function (obj) {
//Get the selected radiobutton value
var type = $.trim($(this).val());
//check if value selected is equal to Yes
if (type == "Yes") {
//find the textbox control based on selected radiobutton control
//Use the props to enable and disable the textbox control
$(this).closest(".container").find(".txtbox").prop("disabled", false);
}
else
$(this).closest(".container").find(".txtbox").prop("disabled", true);
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<table>
<tr>
<td class="container">
<asp:RadioButtonList ID="rblIssues" runat="server" RepeatDirection="Horizontal" TextAlign="Right">
<asp:ListItem Text="Yes" />
<asp:ListItem Text="No" />
</asp:RadioButtonList><br />
<asp:TextBox ID="txtOnwerName" CssClass="txtbox" Enabled="false" runat="server" Text="Sample Value"></asp:TextBox>
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"
SelectCommand="SELECT top 10 [AccountKey], [ParentAccountKey], [AccountCodeAlternateKey] FROM [DimAccount]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment