Wednesday, June 23, 2010

Want to create an html link <a href=""></a> and Iframe using C# - dynamically

// Create a new HtmlAnchor control.
HtmlAnchor NewAnchorControl = new HtmlAnchor();

// Set the properties of the new HtmlAnchor control.
NewAnchorControl.Name = "NewAnchorControl";
NewAnchorControl.HRef = "";
NewAnchorControl.Target = "_blank";
NewAnchorControl.InnerHtml = "Microsoft Home";

// Add the new HtmlAnchor control to the Controls collection of the
// PlaceHolder control.

HtmlGenericControl frame1 = new HtmlGenericControl("iFrame");
frame1.Attributes.Add("runat", "server");
frame1.Attributes.Add("width", "100px");
frame1.Attributes.Add("height", "100px");
frame1.TagName = "iframe";
frame1.Attributes.Add("src", "");


No comments:

Post a Comment