Solved

Pulling Multiple Value with request.Querystring

Posted on 2014-01-02
2
260 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 142

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

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

14 Experts available now in Live!

Get 1:1 Help Now