Solved

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

Posted on 2009-04-09
4
262 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

691 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