C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Passing Multiple Parameters in DataGrid’s Asp:Hyperlink Column


Posted Date: 30 Jun 2004    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Ammar Ahmed SiddiquiMember Level: Silver    
Rating: 1 out of 5Points: 7



Passing Multiple Parameters in DataGrid’s Asp:Hyperlink Column



Some times its necessity for programmers to send multiple parameters in

Datagrid using HyperLink Column. This article will explain as how to

customize value for NavigateUrl to pass multiple parameters.

Lets examine the code given below






< asp:TemplateColumn HeaderText="View Details">
< ItemTemplate>
< asp:Hyperlink runat="server" Text='View Details'

NavigateUrl='< %# "page.aspx?ViewID=" & Server.UrlEncode(Container.DataItem("ListingNo"))

"&Param2="&Server.UrlEncode(DropDown1.SelectedItem.Value)%> '


      ID="Hyperlink1" NAME="Hyperlink1" />

< /ItemTemplate>
< /asp:TemplateColumn>



Summary

Server.UrlEncode is used to create the URL. The query string is appended
by multiple parameters. Hope this code is some help to you



Happy Programming




Responses

Author: Manu    31 Jul 2004Member Level: Bronze   Points : 0
Thankyou

Can I get some Code to do the same while the data is being passed in this form

DataBinder.Eval(Container, "DataItem.Forum")

ie from the dataset

thanks


Author: Rohini Priya    13 Jan 2005Member Level: Bronze   Points : 0
Pretty common requirement but was very hard to find anywhere. After quite a bit of search, here was the answer to Multiple Querystring values on a hyperlink column. Thanks Ammar.

However I did notice a minor error but a major problem in the solution.
An "&" is left between the two passing parameters.
Here is the updated version.



Another method



With Databinder.Eval method



Again Thanks Ammar.
Happy Programming !!

Rohini



Author: Ammar Ahmed Siddiqui    09 Feb 2005Member Level: Silver   Points : 0
Dear Rohini Priya,
Thank you for your feedback and sorry for replying late.
Regards
Ammar Siddiqui


Author: RAfael Cristiam Araújo Ribeiro    15 Feb 2005Member Level: Bronze   Points : 0
Why when I do this command, the page returns this error:
Mensagem de Erro do Compilador: CS0118: 'System.Web.UI.WebControls.DataGridItem.DataItem' denota um 'propriedade' quando 'método' era esperado

In English:
A Method is expected and I 'm including a Properties


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Doing case-InSensitve comparisons using XPath in XML
Previous Resource: Creating a Word document using ASP.NET and C#
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use