Solved

Pulling Multiple Value with request.Querystring

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

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…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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