Question

2007 Hi,

I've created a new Edit Page for a document library, I've used a Custom List form to generate it and added a 'FileUpload' to it.

I've create a dll that overloads the page, so that on a postback I can get the content of the FileUpload. However, I cannot get a reference to the DVWP on the page. Page.FindControl doesn't work (null), if I use the SPLimitedWebPartManager, then I get the DataForm WebPart but there are no controls in it to reference.

If I use smartpart and make it an ascx, the xsl bombs with an 'input string not in correct format error'.

So in short: When a page is loaded how can I get hold of the a DataViewWebPart, and find it's controls? Can I get a reference to the Page WebPart manager instead and find it? Regards Paul

Was it helpful?

Solution

Try writing a recursive FindControl method. FindControl only searches for controls directly inside the NamingContainer of the control it was called on. Your DVWP probably sits deeper down in the Control tree.

Also ensure your code does not run "too early" in the Page lifecycle.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top