This article will shoe you hoe you can display calendar
control selected date into javascript alert message in asp.net.
Some of my previous articles are as follows: Confirm
Message Box With Ok and Cancel Detect On Button Click Using JavaScript In HTML
and Asp.net, Alert
Message On Button Click Using JavaScript In HTML, Popup
Window Open Without Page Refresh in Asp.net MVC Using javaScript, JavaScript
Alert Message On Conditional Bases In Asp.Net MVC Using C#.Net, Javascript
Confirm Message On Submit Button Click In Asp.Net MVC Using C#.Net, Dynamic
Histogram Google Chart in asp.net MVC using C#.net, JavaScript, Gridview
Selected Row Value Pass to JavaScript Function On Hyperlink Click in Asp.net
Using C#.Net.
So for this article first we will create a new asp.net
application and add the below code into you page.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="WebApplication1.WebForm6"
%>
<!DOCTYPE html
PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script language="javascript">
function
DisplayDate() {
var
calendarDate = '<%= Calendar1.SelectedDate %>';
alert(calendarDate);
}
</script>
<title>Display
Calander Control Selected Date Into Javascript Alert Message In Asp.Net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Calendar ID="Calendar1" runat="server" ></asp:Calendar>
<asp:Button ID="Button1" runat="server" Text="Get Date" OnClientClick="javascript:DisplayDate();"/>
</div>
</form>
</body>
</html>
|
Now we will check the javascript code which will used to
display the selected date using javascript.
<script language="javascript">
function
DisplayDate() {
var
calendarDate = '<%= Calendar1.SelectedDate %>';
alert(calendarDate);
}
</script>
|
Now we have done run the code to check the output.
I need this code in mvvm c# .Net can you please send this one
ReplyDeleteI need this code In mvvm c# .Net .Can you send this one
ReplyDelete