Passing Multiple Parameters in NavigateURL Property of Hyperlink

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.

posted on 2004-07-21 09:36  小牛哥  阅读(943)  评论(2编辑  收藏  举报

导航