How jQuery Datepicker use in WebControl
I work on Asp.Net VS08 C#. i create a web control .How to use JQuery Datepicker on webcontrol.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="wcCalendar.ascx.cs" Inherits="Jquery1._8Version.wcCalendar" %>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8rc2.custom.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8rc2.custom.min.js"></script>
<script type="text/javascript">
$(function() {
$("#dtpCalendar").datepicker();
});
</script>开发者_运维百科;
<div>
<asp:TextBox ID="dtpCalendar" runat="server"></asp:TextBox>
</div>
I want to use this control on .aspx page ,
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="JGrid.aspx.cs" Inherits="Jquery1._8Version.JGrid" %>
<%@ Register src="wcCalendar.ascx" tagname="wcCalendar" tagprefix="uc1" %>
<!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">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:wcCalendar ID="wcCalendar1" runat="server" />
</div>
</form>
</body>
</html>
Clicking on textbox Datepicker not show? how to solve it?
The problem is that the id of the textbox isn't "dtpCalendar" when its rendered to the client. You can do something like this to solve the issue:
$("#<%=dtpCalendar.ClientID%>").datepicker();
精彩评论