Hello everybody!

I have encountered a problem and I didn't manage to find any soultions yet. Let me simplify things a bit.

I have 2 forms, the first contains an ASP ListBox with multi select mode enabled. I submit the form and in the other form I use just for testing purposes this snippet of code:

protected void Page_Load(object sender, EventArgs e)
            foreach (string formKey in Request.Form.AllKeys)
                if (formKey != null)
                    if (formKey.Equals("ctl00$MainContent$ListBox1"))
                        Label1.Text = Request.Form[formKey];

The problems is that the values that come from the listbox (the values that i selected in the previous form) are separated by "," for ex. "test1,test2,test3". How can i change this separator to "$" for example? I need to change it because the actual values may contain "," and i don't manualy feed them to the listbox.

I can't use any other mode of transfering this values between the form because the entire application uses this model. The values that i get are then sent to a workflow where there will be manipulated and in the workflow i need to know where each listbox item starts and ends so it must be an unique separator.

Any help is apreciated! Thank you very much

Recommended Answers

All 2 Replies

Can't you simply do a string replace() on the resulting string to get the separator character you want?

Yes but this will also replace the intended "," if there is any in the actual values, so it must be something else done before the values are sent.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.