我真的很難與此,我發現一個很好的日期範圍選擇器,使用Jquery的問題是我需要抓住已輸出到按鈕的文本,以便我可以查詢我的sql數據庫。我認爲最好的方法是將jquery按鈕輸出到標籤,然後有另一個標題爲搜索的按鈕來抓取已選擇的日期。下面是一些代碼JQuery文本標籤
<head>
<link href="jquery-ui.min.css" rel="stylesheet">
<link href="jquery.comiseo.daterangepicker.css" rel="stylesheet">
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
<script src="moment.min.js"></script>
<script src="jquery.comiseo.daterangepicker.js"></script>
<script>
$(function() { $("#e1").daterangepicker(); });
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="e1" name="e1"><label for="no">text no</label> <<<Hoping to
add
the values from "e1 to say Value1.Text
<asp:Label ID="Label1" runat="server" Text="Label" name="e1">
</asp:Label>
</form>`
然後當我點擊搜索它抓住的日期範圍,並把它放到我的查詢:
protected void Search_Click(object sender, EventArgs e)
{
string testdb =
ConfigurationManager.ConnectionStrings["easystone"].ConnectionString;
SqlConnection con = new SqlConnection(testdb);
SqlDataAdapter graph = new SqlDataAdapter("SELECT [User], [dateof]
FROM [dbo].[chart]where [dateof] >='"+Label1+"' and [dateof]
<='"+Label2+"'",
con);
DataTable graphdata = new DataTable();
graph.Fill(graphdata);
chart1.DataSource = graphdata;
chart1.ChartAreas["ChartArea1"].AxisX.Title = "";
}
`
你缺少問題.. – Webruster