Solved

Pulling Multiple Value with request.Querystring

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

3 Use Cases for Connected Systems

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tutorial for ebay api 3 32
Footer for each row on Gridview 2 21
C# Gridview 1 29
Function after success of Jquery/AJAX action 9 5
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…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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