C# id的当前上下文不存在
我怎样才能从日期选择器那里获得会话 对于我所有的文本框,我使用以下方法保存它:C# id的当前上下文不存在,c#,asp.net,C#,Asp.net,我怎样才能从日期选择器那里获得会话 对于我所有的文本框,我使用以下方法保存它: Session["location"] = DropDownList1.SelectedItem.Text; Session["time"] = DropDownList2.SelectedItem.Text; Session["day"] = DropDownList3.SelectedItem.Text; Session["IsChauffeurUsed"] = DropDownList4.Selec
Session["location"] = DropDownList1.SelectedItem.Text;
Session["time"] = DropDownList2.SelectedItem.Text;
Session["day"] = DropDownList3.SelectedItem.Text;
Session["IsChauffeurUsed"] = DropDownList4.SelectedItem.Text;
但是对于我的文本框日期选择器,当我编写代码时
Session["date"] = datepicker.Text;
它给了我一个错误,当前上下文不存在。
“日期选择器”文本框为:
<div class="demo"><p>Date: <input type="text" id="datepicker"></p></div>
日期:
希望你能帮忙
谢谢。设置
runat=server
属性以将html标记转换为html服务器控件
<input type="text" runat="server" id="datepicker">
Session["date"] = datepicker.Value;
编辑:这对我来说非常有效
<head runat="server">
<title></title>
<link rel="Stylesheet" type="text/css" href="http://code.jquery.com/ui/jquery-ui-git.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<script type="text/javascript">
$(function () {
$("#datePicker").datepicker();
$("#<%=TextBox1.ClientID %>").datepicker();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="text" id="datePicker" runat="server" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>
$(函数(){
$(“#日期选择器”).datePicker();
$(“#”)日期选择器();
});
它正在工作,但在我更改代码后,我的日期选择器不会弹出。你能告诉我为什么吗?这是(datepicker)jQueryUI小部件吗?也许标签不是这样关闭的:“谢谢@AVD!!!!!”!!!!!!你救了我!!!!!你真是个好帮手!非常感谢。你不知道,我花了很长时间做这个角色!非常感谢。你让我开心!