Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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

12 Experts available now in Live!

Get 1:1 Help Now