Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Pulling Multiple Value with request.Querystring

Posted on 2014-01-02
2
Medium Priority
?
274 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
[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
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

722 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