Display message while function execution to UI without postback - asp.net
I am using asp.net.
I have several Insert statement on my .cs file on submit button click. I want that after each insert statement execute, it will show the message on the webpage [UI] [ex: inserted in table 1].
Like:
button_click_eve开发者_Go百科nt { Insert statement 1 if(done successfully) display message on UI for statement 1
Insert statement 2 if(done successfully) display message on UI for statement 2
Insert statement 3 if(done successfully) display message on UI for statement 3
..... and so on... }
just like we got the screen while installing SQL Server, we get successful message after every operation.
I don't want postback to happen for this. How can I do that?
Basically, you can't do this without multiple requests to the server. HTTP is a request/response protocol. While you could potentially just send the "page so far", it would be incomplete HTML and almost certainly render badly.
The best user experience would probably be to use AJAX for this - don't do a full page refresh, just change the appropriate section of the DOM based on the response to a status request.
I have googled and find out a link through that you can achieve results as described above format.
http://msdn.microsoft.com/en-us/magazine/cc163553.aspx
In this link when you download source code please see ContextSens.aspx page, here after click on start task button message will be display as above described format.
Hope it will help for you.
精彩评论