【发布时间】:2017-08-26 15:14:27
【问题描述】:
我有一个 DropDownList,它与 SqlDataSource 连接,我在该 DropDownList 中传递了两个值
1.ReportName = 默认值TotalSales
2.UserID = 是会话值Session["UserID"]
这是我的代码
Aspx.code
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HQWebMatajer13 %>" SelectCommand="SELECT [UserFileName] FROM [ReportSave] WHERE (([ReportName] = @ReportName) AND ([UserID] = @UserID))">
<SelectParameters>
<asp:Parameter DefaultValue="TotalSales" Name="ReportName" Type="String" />
<asp:SessionParameter Name="UserID" SessionField="UserID" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
我已经在我之前的页面 UserReports.aspx
中传递了会话中的值那个页面代码:
protected void linkTotalSales_Click(object sender, EventArgs e)
{
Session["UserID"] = Session["UserID"].ToString();
Response.Redirect("ReportTotalSalesPivot.aspx");
}
当我从 UserReports.aspx 页面单击TotalSales 的链接时。
它显示以下错误
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'UserID'.
【问题讨论】:
标签: c# asp.net session session-cookies