Home             About Us             Sign Guest Book             Contact Us             Subscribe              RSS  
Articles
Tools
Code Snippets
Links
Tips & Tricks
FAQ
Resources
Articles
Code Snippets
Links
FAQ
Resources

Saravana Kumar
Vinod Kumar

Click on the image to subscribe to our Monthly Newsletter.


Click here for Archives

No Chats Available

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,"ProductName").tostring%>' 
                          NavigateUrl='<%# "page.aspx?Name=" & DataBinder.Eval (Container.DataItem,"ProductName").tostring & _  
                          "&ProductID=" & DataBinder.Eval(Container.DataItem,"ProductID").tostring %>' ID="ProductName"/>  
  
                      </ItemTemplate>
                     </asp:TemplateColumn>                                    
         </Columns>
</asp:datagrid>

This is how you can pass two paramaters to NavigateURL property of Hyperlink column in DataGrid.

Comment about this article
Free Hit Counters
Free Hit Counters