Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:39:22+00:00 2026-06-04T21:39:22+00:00

I have a gridview with a hyperlink in first column. Upon clicking the hyperlink,

  • 0

I have a gridview with a hyperlink in first column. Upon clicking the hyperlink, the user is redirected to Vendor.aspx. Now, I need to pass the consumer id (of the clicked row) as a query string to the Vendor.aspx.

What is the best method to achieve it? Is there a way in which we can handle it using markup code only?

  <asp:GridView ID="grdConsumers" runat="server" AutoGenerateColumns="False" 
                EnableViewState="True" >
                <Columns>

                   <asp:TemplateField HeaderText="ConsumerID" SortExpression="ConsumerID" >
                    <ItemTemplate>
                        <asp:HyperLink ID="lnkConsumerID" href="Vendor.aspx" runat="server"><%# Eval("ConsumerID")%></asp:HyperLink>
                    </ItemTemplate>
                    </asp:TemplateField>



                    <asp:BoundField HeaderText="Status" DataField="Status" SortExpression="Status"></asp:BoundField>
                </Columns>
            </asp:GridView>

READINGS:

  1. Set Gridview DataNavigateUrlFormatString Dynamically inside User Control(ASCX)

  2. How do I add "&Source" to DataNavigateUrlFormatString?

  3. Select row in GridView with JavaScript

  4. How to bind the URL of a GridView HyperLinkField when the bound value contains a colon?

  5. asp.net gridview DataNavigateUrlFormatString from DataSource

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:39:23+00:00Added an answer on June 4, 2026 at 9:39 pm

    Try using the DataNavigateUrlFormatString

    <ItemTemplate>
        <asp:HyperLinkField DataNavigateUrlFields="ConsumerID" DataTextField="ConsumerID" DataNavigateUrlFormatString="Vendor.aspx?id={0}" />
    </ItemTemplate>
    

    … it will spare you Eval() and the problem with single/double quotes when putting it inside your href.

    You can substitute the DataTextField if you like – I just put the ConsumerID there to be consistent with your example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview with 13 pages with 5 item each. The first column
I have a column in a gridview that has a hyperlink defined in each
I have a gridview where one column is going to be a hyperlink that
HI, I have a HyperLink column in a gridview that when clicked should navigate
want to have a Hyperlink-Button in a gridView in which I can display a
I have a boundfield in a gridview that programatically receives a hyperlink for the
I have a gridview with a column of asp buttons that I toggle the
I have a gridview with a template field that has a HyperLink: <asp:TemplateField ItemStyle-Width=12%
I have GridView and I need HTML ENCODE all values being update using Event
I have a Gridview with a template for this Hyperlink: <asp:TemplateField HeaderText=Notes ItemStyle-CssClass=NoMargin NoPadding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.