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


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.

  • I really should have thought of that! In frustration, I overrode the DataForm control as a new server control which, to my mind is total overkill. Will give your idea a go tomorrow. – Anonymous Jul 8 '10 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy