Answered by:
how retrive values from one page to another page inside iframe

Question
-
User94893061 posted
Hii
i need to pass values from one page to second page.(my second page is within iframe)...what should i do pass values from 1st page to a second page which is in iframe...
1)how to pass those values and how to get those values....please kindly help..thanks in advance..
Saturday, October 20, 2012 5:35 AM
Answers
-
User71929859 posted
Hello,
2)do session variable works inside an page within an iframe.....?Of course it does. Iframe is just a frame to include your webpage. As long as the web pages runs under the same session, session varibales will be available no matter how you display the webpage. But remember that webpage inside the iframe should be with the same context as the parent webpage. Otherwise it won't work.
If the webpage inside the iframe is running in a different domain, then you have to store the values in a database first and then access that DB and get the value from there from the webpage inside the iframe.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, October 21, 2012 7:07 AM
All replies
-
User-691245060 posted
1)how to pass those values and how to get those values....please kindly help..thanks in advance..http://www.intstrings.com/ramivemula/articles/data-transfer-between-two-asp-net-pages/
from iframe, probably querystring would work to post some data to other page..
Thanks,
Saturday, October 20, 2012 5:38 AM -
User-179079940 posted
using querystring to past data
src="demo.aspx?id=1"
Saturday, October 20, 2012 5:40 AM -
User94893061 posted
sir how to pass the value from cs file(hrmanagement.aspx.cs)..to another page..(demot.aspx)the page within iframe..........i don't know how to pass values from querystring..
Saturday, October 20, 2012 6:13 AM -
User94893061 posted
using querystring to past data
src="demo.aspx?id=1"
sir how to pass the value from cs file(hrmanagement.aspx.cs)..to another page..(demot.aspx)the page within iframe..........i don't know how to pass values from querystring..
Saturday, October 20, 2012 6:14 AM -
User94893061 posted
Rounak Rana
1)how to pass those values and how to get those values....please kindly help..thanks in advance..http://www.intstrings.com/ramivemula/articles/data-transfer-between-two-asp-net-pages/
from iframe, probably querystring would work to post some data to other page..
Thanks,
sir as u told to use querystring but sir i m not using response.redirect...i need to pass the dropdownlist selected value from cs file to another page..within the iframe........
Saturday, October 20, 2012 6:43 AM -
User738333362 posted
use the session variable to preserve the data. Or else get the previous page by making view state true.
Thanks.
Saturday, October 20, 2012 6:52 AM -
User94893061 posted
use the session variable to preserve the data. Or else get the previous page by making view state true.
Thanks.
can u elloborate in more detaill...........sirhow can i do it....
Saturday, October 20, 2012 7:22 AM -
User-179079940 posted
response.redirect("demo.aspx?id="+dropdownlist.selectedvalue);
Saturday, October 20, 2012 7:27 AM -
User-1577790784 posted
either use session variable like session["id"] = value
Or
user query string response.redirect(abc.aspx?id=value)
Saturday, October 20, 2012 10:30 PM -
User82750387 posted
You can use response.redirect in Page1, add the dropdownlist value to query string & reteive it in Page2 like this...
In Page1
string ddlValue = dropdownlist.Selectedvalue;
response.redirect("Page2.aspx?id="+ddlvalue);
In Page2 - Page load
if(PreviousPage == null)
{
string ddlvalue= Request.QueryString["ddlvalue"];
if (ddlvalue != null)
lblTest.Text = "REDIRECT: " + ddlvalue;}
Saturday, October 20, 2012 11:38 PM -
User94893061 posted
You can use response.redirect in Page1, add the dropdownlist value to query string & reteive it in Page2 like this...
In Page1
string ddlValue = dropdownlist.Selectedvalue;
response.redirect("Page2.aspx?id="+ddlvalue);
In Page2 - Page load
if(PreviousPage == null)
{
string ddlvalue= Request.QueryString["ddlvalue"];
if (ddlvalue != null)
lblTest.Text = "REDIRECT: " + ddlvalue;}
madam i need to ask u one question..
1) response.redirect will redirect me to next page,,,..i don'nt want to redirect to next page...i just want to store dropdownlist value in one variable and can use that variable in any page...without redirecting to another page..
2)do session variable works inside an page within an iframe.....?
please i f u can help me in this case,,,,,,,,,resonse.redirect doesn't work for me..........thanks in advance
Sunday, October 21, 2012 2:40 AM -
User94893061 posted
response.redirect("demo.aspx?id="+dropdownlist.selectedvalue);
sir i need to ask u one question..
1) response.redirect will redirect me to next page,,,..i don'nt want to redirect to next page...i just want to store dropdownlist value in one variable and can use that variable in any page...without redirecting to another page..
2)do session variable works inside an page within an iframe.....?
please i f u can help me in this case,,,,,,,,,resonse.redirect doesn't work for me..........thanks in advance
Sunday, October 21, 2012 2:43 AM -
User71929859 posted
Hello,
2)do session variable works inside an page within an iframe.....?Of course it does. Iframe is just a frame to include your webpage. As long as the web pages runs under the same session, session varibales will be available no matter how you display the webpage. But remember that webpage inside the iframe should be with the same context as the parent webpage. Otherwise it won't work.
If the webpage inside the iframe is running in a different domain, then you have to store the values in a database first and then access that DB and get the value from there from the webpage inside the iframe.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Sunday, October 21, 2012 7:07 AM -
User-414649453 posted
Hi,
1. You can use Sessionvariable which can be retrieved from any pages of the application.
in page 1
Session["id"] ="1002"
in page 2
string s
s = Session["id"]
2. can use Querystring
Response.Redirect("Page2.aspx?id=" txtbox1.value)
Sunday, October 21, 2012 7:23 AM -
User645986692 posted
To pass value from one page to another when doing Cross-Page Posting:
Using QueryString
Ex:
SourcePage.aspx <asp:Label ID="lblName" runat="server" Text="Name" /> <asp:TextBox ID="txtName" runat="server"></asp:TextBox> <asp:Label ID="lblEmailId" runat="server" Text="EmailId:" /> <asp:TextBox ID="txtEmailId" runat="server"></asp:TextBox> <asp:Button ID="btnSubmit" runat="server" Text="Submit Data to Another Page" onclick="btnSubmit_Click />
SourcePage.aspx.cs protected void btnSubmit_Click(object sender,EventArgs e)
{
string TargetUrl="TargetPage.aspx?";
TargetUrl=TargetUrl + "NameVar" + "=" + txtName.text + "EmailAddressVar" +"=" + txtEmailId.text;
//TargetUrl will appear at Address bar of Browser showing the NameVar=SomeValue and EmailAddressVar=someValue when Submit button is clicked.QueryString carries the value from one page to another page
Response.Redirect(TargetUrl);
}
TargetPage.aspx <asp:Label ID="lblName" runat="server" Text="Your Name is: " /> <asp:TextBox ID="txtYourName" runat="server"></asp:TextBox> //This TextBox will receive value from SourcePage's txtName via Query variable NameVar
<asp:Label ID="lblEmailId" runat="server" Text="Your EmailAdd is: " /> <asp:TextBox ID="txtYourEmailId" runat="server"></asp:TextBox> //This TextBox will receive value from SourcePage's txtEmailId viaQuery variable NameVar
TargetPage.aspx.cs Protected Void Page_Load() { txtYourName.Text=Request.QueryString("NameVar").ToString();
txtYourEmailId.Text=Request.QueryString("EmailAddressVar").ToString(); }
Please click on Mark as Answer if this helped you.
Thanking You.....
SauravKumar
Sunday, October 21, 2012 8:22 AM