Questions tagged [namevaluecollection]

NameValueCollection is a .Net collection of string keys and string values that can be accessed either with by key or by the index.

NameValueCollection is a .Net collection of string keys and string values that can be accessed either with by key or by the index.

References

116 questions
1
vote
1 answer

Alternative for NameValueCollection to be used in serialization

I have a situation where in I cant use a Dictionary for name value collection of strings. My name value pair contains duplicate keys, because I need to support a legacy system. So please don't ask me to stop supporting duplicate keys. I tried to use…
0
votes
1 answer

ViewState .Add(.... or ViewState["XXXXX"] is efficient ?

I have a reasonable dout, ViewState .Add(.... or ViewState["XXXXX"] is efficient ? Eg. 1). ViewState.Add("Example1", value ); 2). ViewState["Example1"]=value; Both gives the same output, 1st one add the Value to the NameValueCollection if that…
Sreekumar P
  • 5,900
  • 11
  • 57
  • 82
0
votes
2 answers

append a Name Value pair to other one

here is the code of the calling method - NameValuePair[] data = { new NameValuePair("first_name", firstName), new NameValuePair("last_name", lastName), new NameValuePair("email", email), new NameValuePair("company",…
Sangram Anand
  • 10,526
  • 23
  • 70
  • 103
0
votes
0 answers

How to convert the UserControl values to NameValueCollectionw?

I have a Web Application in Asp.Net WebForm. On a web page there are two tabs Student1 and Student2 and both the tab contain the same form which has two TextBox fields FirstName and LastName. Now let us suppose, I am currently on the Student1 tab…
Biraj Dahal
  • 57
  • 1
  • 13
0
votes
1 answer

namevaluecollection vs lookup

I need to represent some data that has a key and one or more values, seems there is a namevaluecollection or a lookup. From what I can tell the main difference between the two is that lookup is immutable, is there any other significant differences…
Daniel Powell
  • 8,143
  • 11
  • 61
  • 108
0
votes
2 answers

How can I best log a NameValueCollection into a database field in a readable way?

Is there a standard way of doing this? I had considered using XML, but perhaps there is a more straight-forward way. To clarify, I'm dumping the whole collection in a "details" column in my database - I do parse some but want to keep an archive of…
tofutim
  • 22,664
  • 20
  • 87
  • 148
0
votes
1 answer

Why NameValueCollection instance initialization still compiles with extra comma?

I am using NameValueCollection to store values that I will post to API server later. Today I accidentally added extra comma when I initialize an instance of NameValueCollection like simple code below: NameValueCollection nvc = new…
Hermanto
  • 552
  • 6
  • 15
0
votes
1 answer

Find a key in NameValueCollection

I am trying to find a key in the namevaluecollection. If the key is found then next piece of code should execute else not. My Web.config has below configuration:
user1630575
  • 171
  • 1
  • 15
0
votes
2 answers

How to remove a single instance from a NameValueCollection?

Assuming the following url: Dim nvc As NameValueCollection = HttpUtility.ParseQueryString(http://localhost/Index.aspx?A=23&A=7&A=1) How can I remove a specific instance of A from a NameValueCollection? I can add an additional entry nvc.Add("A",…
DreamTeK
  • 32,537
  • 27
  • 112
  • 171
0
votes
2 answers

NameValueCollection into equivalent javascript

I have a c# code that uses NameValueCollection, and then webclient to send a post request to API. I need to use an equivalent request but using javascript instead of c#, I tried the following: $.ajax({ type: "POST", url: …
Hatem Husam
  • 177
  • 1
  • 3
  • 14
0
votes
1 answer

Setting query string in arrays using namevaluecollection

My URL is formatted as: workareaRefs=1&workareaRefs=2&workareaRefs=3&jurisdictions=1&jurisdictions=2&jurisdictions=4&tags=1&tags=2 etc etc. How can I store all these values as 3 separate arrays as objects? I will be using them to filter in a…
Karim Ali
  • 61
  • 2
  • 10
0
votes
1 answer

NameValueCollection.AllKeys.Contains always returns false

System.Web.HttpContext.Current.Request.Params.AllKeys.Contains(key) always returns false, but System.Web.HttpContext.Current.Request.Params[key] returns the value of the key. Could someone tell me why this is happening? In my case, the key is…
newme
  • 577
  • 6
  • 17
0
votes
1 answer

How do I access a NameValueCollection (like Request.Form or ConfigurationManager.AppSettings) as a dynamic object?

Is there a way to access a NameValueCollection (like Request.Form or ConfigurationManager.AppSettings) as a dynamic object? I'd like to be able to do something like this: var settings = ConfigurationManager.AppSettings.AsDynamic(); var name =…
realbart
  • 3,497
  • 1
  • 25
  • 37
0
votes
3 answers

Encode values in a NameValueCollection C# .net

I have a name value collections which is passed into a method to send to another system via a web client. public string DoExtendedTransferAsString(string operation, NameValueCollection query, FormatCollection formats) { System.Net.WebClient…
Cookie
  • 594
  • 1
  • 12
  • 34
0
votes
0 answers

C# Collection is read-only exception when trying to change value with NameValueCollection

As described in the title im having difficulties changing the Values of a NameValueCollection taken from a custom user.config . For some reason whenever i try to change a value with either SET-method or ADD/REMOVE-method it throws me an exception…
user6548546