Reputation: 123
I have a Button1 on the firstpage.aspx page and by Button1click I call a webservice in the codebehind which passes me a random number.
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim test As localhost.servicetest = New localhost.servicetest
Dim answer as string =test.randomnumber().tostring
End Sub
I have another aspx form secondpage.aspx which only consists of label, which I want to pass the answer variable from the webservice.
I added javascript to the firstpage.aspx which creates an iframe with secondpage.aspx
(function () {
$('#Button1').click(function () {
$('<iframe />', {
name: 'frame',
id: 'frame',
src:'secondpage.aspx'
}).appendTo('body');
});
return false;
});
My first problem is that this way I dont know how to load the variable into the secondpage.aspx before I display them in the iframe.
Who do I do it? Do I really need to take the java code way or can I do all the things in the code behind?
My goal is to create an iframe with a "new instance" of secondpage.aspx with a new random number at every Buttonclick.
I hope you guys can help
Cheers Steven
Upvotes: 0
Views: 38
Reputation: 11
You can use a Session variable (Session[name]) and define a variable on your secondpage to store this value.
On the first page : "Dim answer as string =test.randomnumber().tostring" You have to store answer in the Session and call it in the secondPage
Upvotes: 1