sqldatasourse的值怎么在后台取到?
在2个TextBox中输入一前一后的日期,作为SqlDatasource的参数,得到一个值。这个值怎么在c#后台代码中取到呢?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Try_BackGoundValue_Default" %>
<!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>
<asp:TextBox ID="TextBox_DateFrom" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:TextBox ID="TextBox_DateTo" runat="server" AutoPostBack="True"></asp:TextBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT COUNT(LastName) AS a FROM Employees WHERE (BirthDate > @TimeFrom) AND (BirthDate < @TiemTo)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox_DateFrom" Name="TimeFrom"
PropertyName="Text" />
<asp:ControlParameter ControlID="TextBox_DateTo" Name="TiemTo"
PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
--------------------编程问答--------------------
放在runat="server"的隐藏域里,在cs里this.隐藏域.Value获得
补充:.NET技术 , ASP.NET