?
Solved

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

Posted on 2013-02-06
7
Medium Priority
?
333 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 40

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article discusses how to implement server side field validation and display customized error messages to the client.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

801 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