我希望能够收集 URL 参数并将其传递给 SelectParameter。
我认为这样的事情会起作用,但我将一些代码从代码隐藏到显示级别的方法可能是错误的
<asp:GridView ID="CountryGridView" runat="server" AutoGenerateColumns="false" CssClass="mGrid" OnRowEditing="CountryGridView_RowEditing">
<Columns>
<asp:BoundField ReadOnly="true" DataField="i_SK_Accom" HeaderText="i_SK_Accom" Visible="false" />
<asp:BoundField ReadOnly="true" DataField="Accom_Code" HeaderText="Accom Code" />
<asp:BoundField ReadOnly="true" DataField="Accom_Name" HeaderText="Accom Name" />
<asp:BoundField DataField="OP49_Required" HeaderText="OP49 Required?" />
<asp:BoundField DataField="Weekly" HeaderText="Weekly" />
<asp:BoundField DataField="Daily" HeaderText="Daily" />
<asp:CommandField ShowEditButton="true" ButtonType="Image" EditImageUrl="~/Images/Edit.gif" UpdateImageUrl="~/Images/save.png" CancelImageUrl="~/Images/cancel.png" ControlStyle-CssClass="ImageButton" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="Get_Country" runat="server" ConnectionString="<%$ ConnectionStrings:JFAAdmin %>" SelectCommand="IFACE_JFA_ACCOM" SelectCommandType="StoredProcedure" UpdateCommand="IFACE_JFA_ACCOM" UpdateCommandType="StoredProcedure" >
<SelectParameters>
<asp:Parameter Direction="Input" Name="Statement" Type="String" DefaultValue="CountryGridSelect" />
<asp:Parameter Direction="Input" Name="i_FK_CountryID" Type="String" DefaultValue="Request["i_FK_CountryID"].Trim().ToString()" />
</SelectParameters>
</asp:SqlDataSource>
Request["i_FK_CountryID"].Trim().ToString() 是我试图捕获以作为 i_FK_CountryID 参数传递的 URL 参数
谢谢你的帮助。
马库斯