Reputation: 17960
Using
string iframeSrcPage = iframeMain.Attributes["src"];
to get iframe source, always returns the value which set in aspx page itself,
even that value is changed using javascript code,
iframeObject.src = pageURL;
So, how to get an IFrame src attribute value from ASP.Net code behind?
Upvotes: 2
Views: 12466
Reputation:
it will work fine..
Iframe_id.Attributes.Add("src","YourPage.aspx?label="+123);
Upvotes: 0
Reputation: 27811
Try this: add a hidden
input field (with runat="server"
attribute) and change its value to your IFrame's src
in the JavaScript. That way, you'll be able to read the field's value server-side.
Upvotes: 3
Reputation: 18013
Just found this post, and another post with a better answer.
Here are the details:
this.iframeMain.Attributes["src"] = "http://www.stackoverflow.com";
Taken from: How can I access an IFRAME from the codebehind file in ASP.NET?
Upvotes: 1