Solved

How can I pass a variable through the query string from one listview to another?

Posted on 2009-04-09
4
261 Views
Last Modified: 2013-12-17
I have written a C# .Net web site using visual studio 2008. I have two pages, each containing a asp.net 3.5 listview control bound to a linqdatasorce. All I want to do is pass a variable from one listview to the other through the query string, is this possible?
0
Comment
Question by:Shepwedd
[X]
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
  • 3
4 Comments
 
LVL 15

Expert Comment

by:spprivate
ID: 24107496
There are two way to do this.
When ever you want to go to next page form the querysring something like this.
Response.redirect ("../page2.aspx?param1="+listviewcontrol.selectedvalue;
In the other page
listview2.selectedvalue=Request.Querystring["param"].toString();

Or
Put the value in a Session. So Session["myval"]=istviewcontrol.selectedvalue;
in page 2
listview2.selectedvalue=Session["myval"].tostring();

Make sure in either cases check for null conditions
0
 

Author Comment

by:Shepwedd
ID: 24108102
Using your first approach, on the second listview upon using my version of:

listview2.selectedvalue=Request.Querystring["param"].toString();

I get the error: cannot be assigned to, it is read only?

0
 

Author Comment

by:Shepwedd
ID: 24108117
...and I was entering the code within my LinqDataSources OnSelecting event.
0
 

Accepted Solution

by:
Shepwedd earned 0 total points
ID: 24136759
This solution is as simple as:

<asp:HyperLink runat="server" id="hlNavigate" NavigateUrl='<%#  "~/trustAccounts.aspx?Id=" + Eval("TrustID") %>' Text="Accounts" />
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Name Space error VS2015 1 37
vb.net convert long time to mm:ss 23 22
Get sourcecode path 14 48
PowerShell: Adding ToGB to a script 4 26
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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