问题
I am completely new to SignalR and need to develop a web application.
My Scenario-
I have two aspx page. 1) ActionPage.aspx 2) DispalyPage.aspx
Inside the DispalyPage.aspx, I have one div 'displayDiv'
Inside the ActionPage.aspx, I have one button 'btnaction'
If I click on btnaction(ActionPage.aspx), that time I want to PUSH data in displayDiv (DispalyPage.aspx).
Question- Is it possible that data PUSH from one page to second page?
Any hint on this would be great help. Thanks in advance.
回答1:
There are many ways to pass data from one page to another page
1) Query String
http://www.codeproject.com/Articles/5876/Passing-variables-between-pages-using-QueryString
2) Session
http://www.aspdotnet-suresh.com/2012/11/aspnet-session-state-example-in-c-vbnet.html
3) Cookies
http://msdn.microsoft.com/en-us/library/ms178194.aspx
you can use any of this...
reference link for difference http://sanelite.wordpress.com/2011/01/12/difference-between-application-session-view-state-cookies-query-string/
回答2:
I got the solution using SignalR it self. See the following Method that I have written in the HUB
public void hubMethod()
{
// Call the addNewMessageToPage method to update clients.
oResult = _ows.call("ana", 1, 1);
Clients.Group("Display").addNewMessageToMainDisplay( "response is " + oResult);
}
I have call this method from ActionPage.aspx and client side method "addNewMessageToMainDisplay" I have written in DispalyPage.aspx and its working now
来源:https://stackoverflow.com/questions/18783330/signalr-how-to-push-data-from-one-page-to-second-page