Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Passing additional (non-data bound) parameters from a GridView hyperlink.

Posted on 2006-10-25
3
380 Views
Last Modified: 2012-05-05
Hello gurus. I am in need of passing an additional parameter from a GridView hyperlink.  The value I need to pass is not in the data bound to the GridView control; so I can't do it by simply adding paramters to DataNavigateUrlFields and DataNavigateUrlFormatString. I used to accomplish this with the old DataGrid control like so:

private void dg1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
      if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
      {
            ((HyperLink)e.Item.Cells[0].Controls[0]).NavigateUrl += "&PgIndex=" + curPgIndex;
            ((HyperLink)e.Item.Cells[0].Controls[0]).NavigateUrl += "&XName=" + Request.QueryString["XName"];
            ((HyperLink)e.Item.Cells[0].Controls[0]).NavigateUrl += "&strSQL=" + strSQL;
            ((HyperLink)e.Item.Cells[0].Controls[0]).NavigateUrl += "&XState=" + Request.QueryString["XState"];
      }
}

... but, of course, the new GridView control is different.
How do I accomplish this?
I am in an urgent time crunch.
Thank you in advance for your advise.
0
Comment
Question by:jaerob
3 Comments
 
LVL 12

Accepted Solution

by:
Pra4444 earned 500 total points
ID: 17804780
can you not use a helper function to catch the values?? I havent  used gridview much..but just a suggestion...

http://www.eggheadcafe.com/community/aspnet/6/10004766/passing-parameters-from-g.aspx
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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