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

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

1 Answer 1

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

 
discard

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