开发者

How to get an IFrame src attribute value from ASP.Net code behind?

开发者 https://www.devze.com 2022-12-21 16:01 出处:网络
Using string iframeSrcPage = iframe开发者_如何学PythonMain.Attributes[\"src\"]; to get iframe source, always returns the value which set in aspx page itself,

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); 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号