I have a web-part which populates a drop-down full of possible pages located within a sharepoint list, based on some specific criteria defined by the user.
The idea is to have a user specify their criteria, and then select a specific page from the drop-down, which would then load that HTML page into an iframe below the drop-down for immediate viewing.
I’m having trouble understanding how to approach this problem though. When I created a WebPart in VS, I selected “Web Part”, which only gave me a .cs file.
From the CS file, I understand that I can do things like:
protected override void CreateChildControls()
{
Controls.Clear();
myTextBox = new TextBox();
Controls.Add(myTextBox);
...
}
And so on. From my understanding, this runs at the server, and then a page is served up to the client and then rendered. In my mind, the only way to “create” some HTML would be to use something like HtmlTextWriter, but I’m not positive if that is the right angle of attack.
So I guess my question is, should I be using a Visual Web Part instead, and how would I go about adding an iframe to a WebPart, and then changing it’s properties (src, etc.) and have it render a page “on the fly”?
Thanks.
1 Answer