Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

i am creating a dynamic Page Viewer web part from the user control code behind .. something like this:

PageViewerWebPart oWebPart = new PageViewerWebPart(); 
oWebPart.ContentLink = WebPart.WebPartContentLink.ToString(); 
Controls.Add(oWebPart);  

the problem i am having is Height/Width.... do i need to provide user to set the height and width for the Page Viewer in the Prop window?

oWebPart.Height = "<user input>" 
oWebPart.Width  = "user input>" 

any help how should i deal with this issue?

I try to set the Height/Width of the web part that i have created through:

Appearance>>>Height/Width

but no avail.

custom web part for Page Viewer web part through code-behind but i am unable to set height and width after i edit my custom web part and i select inches and set to 12 but nothing has happen...

Any Insight?

share|improve this question

1 Answer 1

I have a brief description of how to the user can update the nested web part with the default properties editor here.

Basically, you would write something like this in your code-behind:

oWebPart.Height = this.Height  
oWebPart.Width  = this.Width

That way, your nested page viewer web part will inherit what the user typed.

The page viewer web part is just an <iframe> element in the HTML, while your web part is most likely a <div> element surrounding it. By default the <iframe> has a fixed size, which is why the default properties resizing the <div> appears to disregard resizing the page viewer.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.