Sunday, October 22, 2006

InfoPath Attachment control and the InfoPathViewer WebPart

A while ago I wrote a posting about how you can use a webpart to render an InfoPath form when using Forms Server in SharePoint Server 2007. I however noticed that when you add an attachment control to this form - it does not seem to work. When I took a closer look at the MSDN article - Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form - I noticed the next paragraph:

 

Note The encoding type (enctype) attribute is necessary only if you intend to use the File Attachment control in a form loaded into the XmlFormView control. If this attribute is not set properly, the File Attachment control will appear to function but will not upload a file to the server running InfoPath Forms Services.

So you will need to add the next line to the CreateChildControls method:

 

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), _
"Upload", "<script language='javascript'><!-- javascript:document.forms[0].encoding='multipart/form-data'; --></script>");
 
tags: , , , , , , 

1 comment:

Susant said...

Hi,
I'm Susant,i have a similar problem,

Can you please tell me where i can add the CreateChildControls() Method

Thanks in Advance,
Susant