Archive

Archive for August, 2015

Get the selected item value from RadiobuttonList using JQuery

August 11, 2015 Leave a comment

Hi all,

Try this example to get the selected item value from RadiobuttonList using JQuery


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
//Attach click event to button
$('#Button1').click(function (e) {
//Get the selected item value from RadioButtonList
var rblSelectedValue = $("#<%= RadioButtonList1.ClientID %> input:checked").val();
$("#<%= lblSelectedValue.ClientID %>").text(rblSelectedValue);
//Get the selected item text value from RadioButtonList
var rblSelectedText = $("#<%= RadioButtonList1.ClientID %> input:checked").next().html();
$("#<%= lblSelectedItem.ClientID %>").text(rblSelectedText);
//Cancel the postback
e.preventDefault();
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Value="1" Text="First"></asp:ListItem>
<asp:ListItem Value="2" Text="Second"></asp:ListItem>
<asp:ListItem Value="3" Text="Third"></asp:ListItem>
<asp:ListItem Value="4" Text="Fourth"></asp:ListItem>
<asp:ListItem Value="5" Text="Fifth"></asp:ListItem>
</asp:RadioButtonList>
<asp:Button ID="Button1" runat="server" Text="Get Selected Value" />

Selected Value
<asp:Label ID="lblSelectedValue" runat="server" Text=""></asp:Label>

Selected Item
<asp:Label ID="lblSelectedItem" runat="server" Text=""></asp:Label>

Hope this helps

Good Luck.

Categories: ASP.Net, Jquery

Disable Future Dates in AJAX Control Toolkit Calendar Extender Control in ASP.Net

August 6, 2015 Leave a comment

Hi all,

Try this example to Disable Future Dates in AJAX Control Toolkit Calendar Extender Control in ASP.Net

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<asp:TextBox ID="txtCalendar" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtCalendar"></asp:CalendarExtender>
</form>
</body>
</html>

In Code behind :

protected void Page_Load(object sender, EventArgs e)
{
//To Disable the Future Dates in CalendarExtender control
CalendarExtender1.EndDate = DateTime.Now;
}

Hope this helps

Good Luck.

Categories: AJAX, ASP.Net