Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-09
4
Medium Priority
?
265 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 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