Request.QuerStrin value in gridview hydperlinkfield

Posted on 2009-02-19
Last Modified: 2012-08-13
I want a querystring value to be concatenated in the  hyperlink field which has the value from another data column

Eg: DataNavigateFormatURLString="page.aspx?value=<%Request.QueryString["val"]%>&val2={0}"
output should be like page.aspx?value=12&val2=ABCD
12 is from the page's query string and ABCD is from another column in the datagrid.
<asp:HyperLinkField DataNavigateUrlFields="Plan ID" DataNavigateUrlFormatString="NominationRegistration.aspx?Plan={0}&schedule='<%$ Schedule>'"

                        HeaderText="Register" Text="Register for this Certification" />

Open in new window

Question by:MGGReddy
    LVL 18

    Expert Comment

    by:Richard Lee
    Try the following:

    ='<%# String.Format("page.aspx?value={0}&val2={1}", Request.QueryString["val"], val2) %>'

    LVL 10

    Accepted Solution

    Should use DataNavigateUrlFields and DataNavigateUrlFormatString, thats why they exist ;)

    <asp:HyperLinkField DataNavigateUrlFields="Plan,ID" DataNavigateUrlFormatString="NominationRegistration.aspx?Plan={0}&schedule{1}" DataTextField="YourColumnTextToDisplay" />

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on could not pull conte…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now