views:

10

answers:

1

I have used jQuery to invoke an AJAX webmethod in c#. This webmethod runs a query and stores the resulting information in a session variable. I have a gridview that has an objectdatasource that uses the session variable with the selectmethod to then populate the gridview with data from a query. I need the final piece to get the gridview to databind() again with the new value.

So click map, update gridview. However, maybe I'm going about this all wrong. In essence, take javascript variable, push to ASP.NET in C# and refresh gridview on page with new data from query.

I've looked into all kinds postings and I'm missing something somewhere. Anybody got any ideas?

+1  A: 

Perhaps one of the simplest things you could do given what you've got already is to wrap the grid in an update panel. Add an aspx button to the page but make it's visibility hidden. Add an async trigger to the update panel based on the click event of that hidden button. When the ajax call succeeds, call $("[id$=btnId]").click(). Add an event handler in your code behind of that button to update your grid.

Not the most elegant solution, but it's probably the quickest win for what you've currently got.

Chris Conway