How do I dynamically set source of an IFrame?
问题 I have an IFrame embedding a youtube video. I want to create a textbox where user (admins) can paste a new src (URL) of video and the IFrame take the new source. Here is what I have so far: protected void Edited_Click(object sender, EventArgs e) { // HtmlControl frame1 = (HtmlControl)this.FindControl("frame1"); string url = TextBox1.Text; frame1.Attributes["src"] = url; } And in the html code is the Iframe: <div id="video"> <iframe title="YouTube video player" runat="server" width="420"