473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using a query string to pass a hyperlinkfield value to another page

347 100+
I have a page with a gridview and I want to pass the value when a user clicks on a hyperlinked field in the grid to another page. Here is the code for the gridview:

Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="GridView1" runat="server" HorizontalAlign="Center" 
  2.             AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
  3.             <Columns>
  4.                 <asp:BoundField DataField="SchedName" HeaderText="SchedName" 
  5.                     SortExpression="SchedName" />
  6.                 <asp:BoundField DataField="ActivityDate" HeaderText="ActivityDate" 
  7.                     ReadOnly="True" SortExpression="ActivityDate" />
  8.                 <asp:BoundField DataField="By" HeaderText="By" SortExpression="By" />
  9.                 <asp:BoundField DataField="Activity" HeaderText="Activity" ReadOnly="True" 
  10.                     SortExpression="Activity" />
  11.                 <asp:BoundField DataField="FirstListing" HeaderText="FirstListing" 
  12.                     SortExpression="FirstListing" />
  13.                 <asp:HyperLinkField DataTextField="OnCallStart" HeaderText="OncallStart" 
  14.                     NavigateUrl="\website1\Default2.aspx" SortExpression="OnCallStart" />
  15.                 <asp:BoundField DataField="OnCallEnd" HeaderText="OnCallEnd" ReadOnly="True" 
  16.                     SortExpression="OnCallEnd" />
  17.             </Columns>
  18.         </asp:GridView>
  19.  
and when a user clicks on the OncallStart field, I want to pass the values of whatever is in that field to the next page. Can someone give me an example of how to do that?

Thank you

Doug
Apr 21 '11 #1
2 2844
dougancil
347 100+
I receive the following error when I try to pass values between web pages:

Literal content ('<asp:HyperLinkField DataTextField="OnCallStart" HeaderText="OncallStart"
NavigateUrl="\website1\default2.aspx" SortExpression="OnCallStart" DataNavigateUrlFormatString=”default.aspx?oncallst art={0}"/>') is not allowed within a 'System.Web.UI.WebControls.DataControlFieldCollect ion'. Can someone please help me to pass values between 2 pages? I've read several forums and this seems to be the way to go but I can't make it work.

Thank you

Doug
Apr 21 '11 #2
Frinavale
9,735 Expert Mod 8TB
During the GridView's OnRowDataBound Event, set the URL of the HyperLink to include Query String parameters that you require in order to pass info to the second page.

-Frinny
Apr 27 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dr. Oz | last post by:
Hi, I am trying to read in a query string from one page and build a link to another page based on the query string. Here's the code I am using to read in the query string: <script...
1
by: Phil M | last post by:
I want a textfield on a form to show the result of a query (see below). Using the expression builder, I set Default Value to: =! But when I try the form, it comes up #Name? What am I doing...
2
by: Martin Tully | last post by:
I am trying to a create a page that will query a SQLDB get customer information and then pass this information on to another page creating almost like a mail merge letter. I can get the information...
2
by: Jeff Johnson [MVP: VB] | last post by:
Subject pretty much says it all. I'm testing a page that, at the moment, I have no links to from other pages. The page requires a query string, so simply setting it as the start page in the IDE is...
18
by: A.M | last post by:
Hi, Is there any way to call a WSS web service method by using browser and see the XML result in browser as well? I have been told that there is query string syntax for calling...
2
by: Milkstr | last post by:
is it possible to pass dynamic text through the query string command?? I know you can just pass a variale through a link eg. www.text1.com/text1.asp?username="Mike" but i want to use the...
3
by: Skip | last post by:
OK, I'm a novice in JS but have lots of coding experience. I am trying to accomplish something that would seem somewhat simple - BUT IT'S NOT. I have a basic window that calls another window...
1
by: agarwasa2008 | last post by:
Hi, I am new to VB .NET programming. I need to display a value on a web form called FeatureList.aspx. Here are the details: The web form FeatureSearch.aspx contains a user control called...
3
by: nse111 | last post by:
I use PHP sessions to pass a value from one page to another. In my 1st page I pass a value called 'id' to my 2nd page using a hyperlink. explained: <a href="abc.php?id=<?php...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.