VS2010 page with an UpdatePanel and a UserControl. The page is a search utility for a large table with > 10 criteria. The UpdatePanel receives the search results. The UserControl is a new addition to the page.
Let's say the page finds people who own music CDs. Previously, each person had a genre associated with their ID and this was a 1-1 relationship. The DB has been updated to support Many-to-many so the UserControl is there to implement the selection of multiple genres when searching.
Basically, whereas before you could only find people into Heavy Metal. You can now find people into Heavy Metal AND Punk (AND ...)
The usercontrol sends an html table back to the page and jQuery responds to keyup() by changing the CSS classes so that the possible options are either invisible, visible or pinned if the user clicks on a visible one.
So I have this:
<tr class='genre_hidden'><td>Jazz-Bebop</td></tr>
<tr class='genre_hidden'><td>Jazz-Trad</td></tr>
<tr class='genre_hidden'><td>Jazz-Dixie</td></tr>
<tr class='genre_pinned'><td>Punk</td></tr>
<tr class='genre_pinned'><td>Heavy Metal</td></tr>
<tr class='genre_visible'><td>Classic Rock</td></tr>
The handler for the trigger calls a sproc, which I've changed to accept a table value parameter of the selected genres. What I need is a way of getting those genres from $('.genre_pinned')
to the handler so I can build the DataTable
to pass to the sproc.
Cheers, .pd.
What I have working:
- handle click event of Search button in UpdatePanel
-- in this function, fire an ajax request to a webmethod on the main page
-- webmethod generates key for session and
-- ajax success copies key to a server hidden input
-- preventdefault not called so normal button action occurs
- button click handler on server side
-- retrieve key from hidden control
-- convert list to datatable fitting table value parameter type
-- add datatable to params and call sproc
Am I breaking any rules/is there a better way?