您的位置:首页 > 运维架构

Passing Multiple Parameters in NavigateURL Property of Hyperlink

2004-07-21 09:36 429 查看
One of the frequently asked questions in newsgroups is, how do I pass multiple parameters in the hyperlinkcolumn of a datagrid. If you need to pass multiple parameters then convert that column to itemtemplate hyperlink column and then pass multiple parameters using navigateURL property. Consider an example in which you need to pass two parameters to Navigate URL,

<asp:datagrid id="Datagrid3" runat="server" AutoGenerateColumns="False" BorderColor="black"
HeaderStyle-CssClass="tableHeader" ItemStyle-CssClass= "tableItem">
<Columns>
<asp:TemplateColumn HeaderText="Order">
<ItemTemplate>
<asp:Hyperlink runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Name")%'
NavigateUrl='<%# "page.aspx?Name=" + DataBinder.Eval (Container.DataItem,"Name") +
"&ProductID="+ DataBinder.Eval(Container.DataItem,"ProductID")%>' ID="ProductName"/>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>

This is how you can pass two paramaters to NavigateURL property of Hyperlink column in DataGrid.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: