views:

637

answers:

2

I am using jQuery load function to load the HTML response of an aspx page. I call the page by appending querystring parameters to the end. I have a problem though. I have a checkbox list (multi selectable) and couldn't figure out how to send these selections. If it was server side, I would make a custom class carrying all the information, and place it in the Session then take it from there and give the values to sql ... but now with AJAX it seems querystring is my only option .. what do I do? (comma seperating them?) thanx in advance

A: 

Create a form using the GET method. Create a bunch of checkboxes not dissimilar to the bunch you're already using. Create a submit button.

Click submit button and see how the browser formats the query string. Problem solved :)

Hope this helps

Afterthought: AJAX is not limited to GETs so you can try the same with a POST form

Darko Z
A: 

You can send them in an array like this -

my-page.aspx?checkboxlist=true&checkboxlist=false&checkboxlist=true

This way, when you do Request.QueryString["checkboxlist"] in your server-side code, you'll get a comma seperated string which can be manipulated after splitting it, using String.Split().

You can also send them using POST instead of a querystring. You can access them using the Request indexer.

Kirtan
why would you need to use '[]' ??
Darko Z
Request.Querystring[] for C#, Request.Querystring() for VB.Net
Nicholas H