[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

ASP.net refresh WebForm before remainder of code runs

Posted on 2011-10-23
8
Medium Priority
?
369 Views
Last Modified: 2012-05-12
Hi

On my ASP.net WebForm I have buttons in a GridView that when clicked change the background color of that row. In the final row, a lot of extra code is run after this and I need the user to see the color change and a message asking them to wait while the rest of the code runs. In the code below this is at the point marked
'Need above two lines to refresh webform before following code
If index = 19 Then
                    Me.Label_Finished.Text = "Please wait a moment........."

'Need above two lines to refresh webform before following code
                Call Load_Answers_Array(index, "Strongly Agree", 5, row.Cells(7).Text)

Open in new window

0
Comment
Question by:Murray Brown
8 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 668 total points
ID: 37017480
You might be able to achieve something easier with AJAX UpdatePanel and UpdateProgress.

UpdateProgress Class
http://msdn.microsoft.com/en-us/library/system.web.ui.updateprogress.aspx
0
 
LVL 28

Assisted Solution

by:strickdd
strickdd earned 668 total points
ID: 37018644
The reason this isn't working is simply that nothing gets sent back to the page until the full postback completes. This has to be done with javascript, AJAX is not required nor is an update panel. You merely need to call a javascript function that will set that rows color in the onclientclick of the button.
0
 
LVL 10

Assisted Solution

by:GlobaLevel
GlobaLevel earned 664 total points
ID: 37018655
in addition to the LearnedOne..

You could create a method that would be raised to handle the gridview.

this link seems to be doing the same thing with JS and gridview server control:
http://www.codeproject.com/KB/grid/GridViewRowColor.aspx

most soultions will follow a similar format:

Protected Sub Directory_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)  


if  e.Row.RowState <> ' last row then
..code...
end if


if  e.Row.RowState  = ' last row then
..code...
end if


end sub


see here for more  links:
http://forums.asp.net/p/992062/1290572.aspx
http://weblogs.asp.net/andrewrea/archive/2008/08/04/gridview-row-click-selection-via-clientside-code.aspx
http://www.geekzilla.co.uk/view9FC28EE6-ACB0-4F51-BFE4-38B0B10134D5.htm
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:Murray Brown
ID: 37019052
can you not force the postback?
0
 
LVL 10

Expert Comment

by:GlobaLevel
ID: 37020648
yes....
0
 

Author Comment

by:Murray Brown
ID: 37020670
Thanks. What VB.net code would you use to do this
0
 
LVL 10

Expert Comment

by:GlobaLevel
ID: 37020815
you have to use javascript...
http://weblogs.asp.net/mnolton/archive/2003/06/04/8260.aspx
http://stackoverflow.com/questions/914911/asp-net-vb-force-postback-in-code-behind


if you want a timed forced postback...you need to add a timer to your JS, then kick off the above...


i think form.submit() should work too...
0
 

Author Closing Comment

by:Murray Brown
ID: 37059111
Thanks for the help. Had hoped there would be a more simple way
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…

591 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