views:

97

answers:

1

I have one web part (the provider) which displays insurance claims in a gridview. When user clicks on one this value(case number) is passed via IWebPartField interface to another web part(consumer) which displays detailed info about the claim. So far so good. I can select different claims in the provider and the details show up in the consumer just fine. The moment I add a TextBox to the consumer, the consumer no longer recognizes the case number passed. I need the user to be able to enter a value in the textbox and click a button to update that claim info. I can debug and attach to process and it looks like it is getting the case in the callback function, etc, but when it is setting parameters for the stored proc in CreateChildControls, it is null. Comment out the TextBox and it works fine.

Any clues as to what is going on? Brand new to Sharepoint web parts...any help appreciated!

thanks, PhilJ

A: 

Hi Phil.

It may be an issue with the way that ShaprePoint renders the controls, so the textbox might not have actually been created at the time you need it. Try adding in a call to EnsureChildControls() in either the OnLoad() or the Render() events.

MacComp
EnsureChildControls is being called first thing in the Render event. The problem is not the textbox being rendered, the problem is that adding the textbox seems to break the connection - when I try to use the value passed from the provider in the Createchildcontrols code, that value is null. If I remove the textbox, all works fine.
Ok. I think that the textbox hasn't been instansiated at the point you're trying to access the value, hence the null. Try setting the parameters in the RenderContents event as opposed to the CreateChildControls.
MacComp