SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
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 posting your answer, you agree to the privacy policy and terms of service.