Solved

Pulling Multiple Value with request.Querystring

Posted on 2014-01-02
2
267 Views
Last Modified: 2014-01-02
I have a a process right now that only pass one value from a  Querystring, but Now  i need to pass a collection on Value from a Query string to a List Collection using C#. Example below

string.IsNullOrEmpty(request.QueryString.Get("HID")) ? MemID: request.QueryString.Get("HID");

This code need to be passed into a queryinput List Collection below

queryinput.ID = string.IsNullOrEmpty(request.QueryString.Get("HID")) ? MemID: request.QueryString.Get("HID");

I keep getting error Cannot implicitly type string to system.collection.Generic list<string>
0
Comment
Question by:DevoinIT
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 39751595
can you please clarify on how you want to pass the "list" of values in the URL?
or, do you actually want to create a "list" with 1 single value, to start with?

in second case, it would be:
List<string> l = new List<string>();
l.Add(string.IsNullOrEmpty(request.QueryString.Get("HID")) ? MemID: request.QueryString.Get("HID") );
queryinput.ID = l; 

Open in new window


hope this helps
0
 

Author Closing Comment

by:DevoinIT
ID: 39751718
This will work fine. I just wanted to place the Querystring values in a list collection and pass the list collection into another list collection.

queryinput.ID - List Collection

List Collection
List<string> l = new List<string>();
l.Add(string.IsNullOrEmpty(request.QueryString.Get("HID")) ? MemID: request.QueryString.Get("HID") );
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

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 …
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

789 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