sending a list of strings from client to server


G

Guest

I have a list of strings in the client side. I want to send them to the
server side processing.
I tried Page.RegisterHiddenField and then in the client wrote the list of
strings as comma separated values. But now the problem of delimetors comes.
(what if the strings already has ',' etc).

Is there any other elagant way to send a list of strings to the server side?

Thanks,
Senthil
 
Ad

Advertisements

T

TPS

Senthil

Try delimiting them with another char like | or ~ or # or something that you
know is not in your strings.

Then split them back apart like this;

string[] myList = myFormVar.Split(new Char [] {'#'});

TPS
 
Ad

Advertisements

P

Peter Rilling

Another alternative would be to dynamically generate the hidden fields on
the client for as many number of entries that you have. That way the
strings do not need to be delimited.
 

Top