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

I have 3 webparts which together will create a table with data in it. The webparts work as follows: LoginWP: A user can enter username and password in 2 textfields and then click on a login button. This activates the login function. This webpart will now provide a ticket which is used to check if the user is logged in.

TypeWP: This web part activates when LoginWP can provide a webpart and uses this login ticket to get Document Types and load these in a ComboBoxList. If a document type is selected this webpart will now provide both the ticket and the document type.

TableWP: This web part will activate when TypeWP provides both a ticket and a document type. It uses both variables to load data into the table.

When the login button is clicked TypeWP will automatically select a first document type and thus activate TableWP. Up to now it all works as expected. Now when i select a different item in the ComboBoxList, TypeWP will lose LoginWP as it's provider and therefore lose it's provider.

After some debugging i managed to find out that the CreateChildControls() of the TypeWP is called when i change the selected comboboxitem. in this CreateChildControls it checks if the LoginWP Provider excists. At this point it doesn't and so the function stops. The next function called is the CreateChildControls of the LoginWP and it creates the provider TypeWP was looking for.

So my question is: How can i prevent the loginWP from recreating itself when i chance the selected item in the combobox or can i save the ticket variable somewhere else so it will be available as long as the user is on the page?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

I traced the error back and used the

CreateChildControls()

and the

OnPreRender()

functions wrong causing the error. I checked for the provider inside the CreateChildControl function. But since the CreateChildControl function of the provider wasn't called yet it couldn't find it. Moving the check and the variable call to OnPreRender solved the error.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.