Using
string iframeSrcPage = iframe开发者_如何学PythonMain.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?
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.
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?
it will work fine..
Iframe_id.Attributes.Add("src","YourPage.aspx?label="+123);
精彩评论