我有这个代码示例。该网页将被另一个通过 url 传递 ID 的网页调用,例如 http://localhost:49780/bookingform.aspx?passedid=8
如何将该 ID 获取到我的 selectcommand 以过滤掉我的记录?例如 ProductID <= passid
代码:
<%@ page language="C#" %>
<!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>
<title>Repeater.DataSourceID Property Example</title>
</head>
<body>
<form id="Form1" runat="server">
<h3>Repeater.DataSourceID Property Example</h3>
<asp:repeater id="Repeater1"
datasourceid="SqlDataSource1"
runat="server">
<headertemplate>
<table border="1">
<tr>
<td><b>Product ID</b></td>
<td><b>Product Name</b></td>
</tr>
</headertemplate>
<itemtemplate>
<tr>
<td> <%# Eval("ProductID") %> </td>
<td> <%# Eval("ProductName") %> </td>
</tr>
</itemtemplate>
<footertemplate>
</table>
</footertemplate>
</asp:repeater>
<asp:sqldatasource id="SqlDataSource1"
connectionstring="<%$ ConnectionStrings:NorthWindConnection%>"
selectcommand="SELECT ProductID, ProductName FROM [Products] Where ProductID <= 10"
runat="server">
</asp:sqldatasource>
</form>
</body>
</html>
问候
茶