ASP.net refresh WebForm before remainder of code runs

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

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
strickddCommented:
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
GlobaLevelProgrammerCommented:
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
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
can you not force the postback?
0
GlobaLevelProgrammerCommented:
yes....
0
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. What VB.net code would you use to do this
0
GlobaLevelProgrammerCommented:
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
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks for the help. Had hoped there would be a more simple way
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.