DateTimepicker in Asp.net - c#

I want to show date and time picker. I googled many times but not getting anything. I download the files from the "keduoi.com" and used in mu project but its not working properly showing only textfield. I am trying from this link.
Here is code:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="LaterTime_Pick_up.aspx.cs" Inherits="LocationBasedTaxiServices.LaterTime_Pick_up" %>
<!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>
<title></title>
<link href="styles/kendo.common.min.css" rel="stylesheet" />
<link href="styles/kendo.default.min.css" rel="stylesheet" />
<script type="" src="js/jquery.min.js"></script>
</head>
<body>
<div id="example" class="k-content">
<div id="to-do">
<input id="datetimepicker" style="width:200px;" />
</div>
<script type="">
$(document).ready(function () {
// create DateTimePicker from input HTML element
$("#datetimepicker").kendoDateTimePicker({
value: new Date()
});
});
</script>
<style scoped>
#to-do {
height: 52px;
width: 221px;
margin: 30px auto;
padding: 91px 0 0 188px;
background: url('../../content/web/datepicker/todo.png') transparent no-repeat 0 0;
}
</style>
</div>
</body>
</html>
It's showing only textfield.

I am not sure unless you can tell exactly what error you are getting. But if you have not added js file then go ahead and do it first.
There are different plans available to get kendo ui. Refer This
There is documentation by kendo for using datepicker in asp.net application.
Link Here

You must include the Javascript for kendoui.
<script src='xxxx/kendo-uixxx.js'></script>

kendo.all.min.js is missing in your code.
You also can use jQuery.UI, it sometimes easier for beginners to start building client interfaces with jQuery.
jQuery UI: http://jqueryui.com/
jQuery UI Datepicker: http://jqueryui.com/datepicker/

Related

Why Bootstrap CSS class table-striped not working in asp.net?

I'm new to Asp.net and bootstrap. I referenced bootstrap.min.css in my html and I have gridview control I want to style with "table table-striped" class. Visual studio intelisens seems to fail to recognize table-striped class and it's not working when the program runs. Any ideas what I'm doing wrong?
Here's my html source:
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="NotDelivered.aspx.cs" Inherits="PapaBobs.NotDelivered" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
<form id="form1" runat="server" class ="container">
<div class ="form-group">
<asp:GridView ID="notDeliveredGrid" runat="server" CssClass ="table table-hover table-striped"></asp:GridView>
</div>
</form>
<script src="Scripts/bootstrap.min.js"></script>
<script src="Scripts/jquery-3.3.1.min.js"></script>
</body>
</html>
Your current href value specifies relative path to css file and browser just cannot load it because this path doesn't exist. Update link to the following
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
Also consider using bundling.

How to show multiple HTML contents in a single page in ASP.Net?

Suppose I'm opening email details in a ASP.Net .aspx page div control. The problem is when I'm opening an email details containing html tag the page is showing messed up. Only the inner html contents are showing on the page. Is there any way I could solve this problem.
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form >
<!-- Outer HTML contents... -->
<div id="dvViewMailReadOnly" style="overflow:auto; width:100%;height:auto;">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<img src="http://click.email.skype...>
</body>
</html>
</div>
</form>
</body>
</html>
The email contents are showing on dvViewMailReadOnly dynamically.
I'm still not sure I understand the problem. Yes, the HTML is invalid, as there must only be one <html> element (and consequently also only one <head> and <body> element).
If you are allowed to modify your form, then you could simply do this:
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form >
<!-- Outer HTML contents... -->
<div id="dvViewMailReadOnly" style="overflow:auto; width:100%;height:auto;">
<img src="http://click.email.skype...">
</div>
</form>
</body>
</html>
Replace < by < and > by >

use DateTimePicker on aspx

I have a Form project that use DateTimePicker and I have to include those components into asp.net aspx webapp.
So I'm trying to include a DateTime Picker on asp.net webform but I can't.
I'm not an expert with aspx so maybe it's really a simple question.
I only see calendar in toolbox but not DateTimePicker.
The one I want to use is
System.Windows.Forms.DateTimePicker
could it be possible to include it into asp.net project?
You can use something like below on the Calender Click Method:
DateTime date = Convert.ToDateTime(calendar.SelectedDate.ToString());
Here calendar is the ID of your calendar control!
Hope this helps.
Because it'is a web application i could just use JQuery UI
http://jqueryui.com/datepicker/#inline
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker - Display inline</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.3/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<form runat="server" id="form1">
Date: <div id="datepicker"></div>
</form>
</body>
</html>
Here is a full API description http://api.jqueryui.com/datepicker/
May be this can help you as an alternative to do this also !\
There is also an Ajax library for .NET. you can try also: http://www.codeproject.com/Tips/407460/How-to-use-ASP-NET-AJAX-Calender-Extender

Trying to convert an old MVC 2.1 project to 3 or 4 but getting some errors

I have used the tool to convert older webform MVC projects to razor, it is found here
http://blogs.msdn.com/b/marcinon/archive/2011/01/13/mvc-3-project-upgrade-tool.aspx
I then used another tool to covert the aspx webform files to razor cshtml files and added them to the project.
The program compiles fine but when it is launched it complains
Error Type: loadXML
Description: incorrect XML
Then none of the existing events are showing on the calendar either.
Here is the index view
#model dynamic
<!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 id="Head1" runat="server">
<title>Index</title>
<script src="/Scripts/dhtmlxscheduler.js" type="text/javascript"></script>
<link href="/Scripts/dhtmlxscheduler.css" rel="stylesheet" type="text/css" />
<style type="text/css">
html, body
{
height:100%;
padding:0px;
margin:0px;
}
</style>
<script type="text/javascript">
function init() {
scheduler.config.xml_date = "%m/%d/%Y %H:%i";
scheduler.init("scheduler_here", new Date(2014, 6, 1), "month");
scheduler.load("/Calendar/Data");
var dp = new dataProcessor("/Calendar/Save");
dp.init(scheduler);
dp.setTransactionMode("POST", false);
}
</script>
</head>
<body onload="init()">
<div id="scheduler_here" class="dhx_cal_container" style='width:100%; height:100%;'>
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
#*<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div>
<div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div>*#
<div class="dhx_cal_tab" name="month_tab" style="right:6px;"></div>
</div>
<div class="dhx_cal_header">
</div>
<div class="dhx_cal_data">
</div>
</div>
</body>
</html>
Can you see where this is messing up? This is using the calendar plugin at http://scheduler-net.com/
I found the answer in another thread, the end result was that I need the following in one of my views
#{
Response.ContentType = "application/xml";
}
found here How do you set the content type for a WebMatrix/Razor Response?

Why is it not showing me calendar under the textbox

I have copied this code from a website http://www.aspdotnet-suresh.com/2012/04/jquery-dropdownlist-selection-for.html and its not showing me the desired output, I'm Naive at this but the calendar is not visible below the textbox which should as per the code.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
<title>jQuery UI Datepicker - Default functionality</title>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
<script type="text/javascript">
$(function () {
$("#txtDate").datepicker({
changeMonth: true,
changeYear: true,
yearRange: '1970:2012'
});
});
</script>
<style type="text/css">
.ui-datepicker { font-size:8pt !important}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="demo">
<b>Date:</b> <asp:TextBox ID="txtDate" runat="server"/>
</div>
</form>
</body>
</html>
You can also set up calendar by using ajax calendar extender..
<asp:CalendarExtender ID="txtDate_CalendarExtender" runat="server"
Enabled="True" TargetControlID="txtDate" Format="dd/MMM/yyyy">
</asp:CalendarExtender>
As per you First statement you copied the code so check that your application contain js folder or not
Make sure that your website project includes the reference files in your project
css/ui-lightness/jquery-ui-1.8.19.custom.css
js/jquery-1.7.2.min.js
js/jquery-ui-1.8.19.custom.min.js
If not you can download the same from jquery site and include same in your project or provide http path for reference files

Categories

Resources