How to call an update SQL Stored procedure from aspButton click and without postbacks

Hello EE,

i have a asp grid view in my webForm and in it I have a ItemTemplate of a checkBox.

if user select lets say Row 1, 6, 7 and 10. then presses a asp:button (that is not in the grid, its rght up front of it) I need to call  a UPDATE SQL stored proc but my problem is I know the OnClick will do a postback and all my dropDown in my webForm will reset and user will need to get back to values he wanted.

actually, those dropdowns are search options and when click search, it populates the grid based on down selectedValues you know.

how can I do?  or maybe I need to save all selcetedvalues somewhere then do the onClick with a postback and call another function that refill everyhing?

I dont know im lost.. any ideas with examples?
Who is Participating?
AshwaniMunshiConnect With a Mentor Commented:
You can refer following article to calling methods using jquery-Ajax

If you want to go with Update panel approach, then refer following article:
Kyle AbrahamsSenior .Net DeveloperCommented:
Just add an update panel.

<asp:UpdatePanel runat="server" ID="updatePanel1">
<your button>

On the button click the grid shouldn't refresh
PhilippeRenaudAuthor Commented:
but what about my other controls on the page ?
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

PhilippeRenaudAuthor Commented:
ahhh ok I understand know.. I should just put ALL the damn thing in the contentTemplate...just in case.
Alan WarrenCommented:
Do you have viewstate enabled for "those dropdowns" and the GridView?
They should maintain state if ViewState is enabled, unless you are programmatically populating your GridView on page load, in which case you could wrap the code that programmatically populates the Gridview in an If not page ispostback then block, so it only fires the first time the page is loaded, then the controls should maintain state through a postback.

Monica PSoftware DeveloperCommented:
using jquery AJAX webmethod call u can make server side code to get called.
PhilippeRenaudAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.