?
Solved

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

Posted on 2013-02-06
7
Medium Priority
?
338 Views
Last Modified: 2013-02-11
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?
0
Comment
Question by:PhilippeRenaud
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 41

Expert Comment

by:Kyle Abrahams
ID: 38861165
Just add an update panel.

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

On the button click the grid shouldn't refresh
0
 
LVL 1

Author Comment

by:PhilippeRenaud
ID: 38861178
but what about my other controls on the page ?
0
 
LVL 1

Author Comment

by:PhilippeRenaud
ID: 38861360
ahhh ok I understand know.. I should just put ALL the damn thing in the contentTemplate...just in case.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 26

Expert Comment

by:Alan Warren
ID: 38861559
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.


Alan
0
 
LVL 10

Expert Comment

by:Monica P
ID: 38862943
using jquery AJAX webmethod call u can make server side code to get called.

http://deebujacob.blogspot.com/2012/01/aspnet-ajax-web-method-call-using.html
0
 
LVL 3

Accepted Solution

by:
AshwaniMunshi earned 2000 total points
ID: 38863031
You can refer following article to calling methods using jquery-Ajax
http://www.codeproject.com/Articles/224827/Jquery-Ajax-Calling-functions

If you want to go with Update panel approach, then refer following article:
http://stackoverflow.com/questions/9257581/using-gridview-inside-updatepanel
0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
ID: 38876253
thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question