views:

210

answers:

2

OK, I hope this hasn't been asked anywhere before (my searching suggests not - but I know thats not a guarentee!!), if it has, please point me to it etc??

My problem is basically this...

I have an asp.net page which a user types in a "search" box, the code behind functions/subs etc produce a list of users matching the search criteria. In front of all the users returned in the search results, I have codded a html checkbox. Under the list of results, there is an "email users" button...

so.. I want to be able to click a number of checkboxes beside the results and then click on "email users" button which should take me to another page with email functionality so an email can be sent to all the previously selected users My confusion is over getting the "selected" user list from the results into the email page.

Because the checkboxes are manually coded within the code-behind file (ie the code basically generates a bit of html and pushes it into a label "placeholder", so I dont get any control functionality to get the checkboxes using the vb code, or can I?

Can anyone please offer suggestions of how I can do this?

Any help would be great, Thanks, Chris

A: 

Would an ASP.NET CheckBoxList work for you?

mjmarsh
I used a checkboxList but am still struggling...Basically I followed tutorial here: http://www.velocityreviews.com/forums/t100700-dynamic-checkboxlist.html.So now I have the checkbox control building nicely instead of me hacking something in, but when I click on my "email" link, this has the portion of code which iterates the checkboxlist but I'm getting a nice "Object reference not set to an instance of an object" error and I can't work out why?! ps, to pass the values to the other page, I'm going to build a , seperated list(string) and add it to a session var and read it from next page?!
I'm guessing I'm getting this error because the list is being generated on the clicking of another button and then when the email button is being clicked (after the list is generated) the postback version of the page knows nothing about the list??? A'm I along the right tracks? and if so, any pointers on how to fix - (How do I post code here to show what I have?)
OK - Noticed so far that this seems to break only when I am using a master page!!... even the sample one on the link above doesn't work when there is a masterpage - thing is, I need the master page so is there a way I can get around this?
A: 

Along with the checkbox list, you could do this using a FormView bound to a IList collection for example.

FormView is a little more flexible. You could, for instance associate more controls to each user/row.

kervin