views:

200

answers:

2

Hello All,

I am stuck with a problem. I am having tool part where I get all the Lists present in the Site.

I have other web part which should get the selected List in the tool part.

I see that the web part is loaded first then the tool part. so the web part is unable to the List selected in the tool part.

Please note that the text box is in a User Control.

Please help me.

+1  A: 

I don't know of any way you could control the load order of elements (web parts) on the same page.

Sounds more like you want to have your second web part (the display of the lists) have a "default" when the page loads--which could be empty. Then it would be changed to the selected list only when the user clicked a new selection in the other web part (the list of lists).

ewall
Hi ewall, I have attached the code. Can you please download it and look at the problem. I have been trying different ways but no luck.
Pradeep007
I would agree with ewall. Webparts are managed by the webpart manager in an asyc way. The only way you could order the webparts is to monitor this and handle events coming from it.
Mike T
Can you please look at the code and help me out.
Pradeep007
+3  A: 

I have looked at your code and found the following:

First things first. You need to move AWAY from using ToolParts and the SharePoint native webpart. they are deprecated and are a remnant from SPS2003. In MOSS / WSS 3.0 you can and should use the ASP.NET WebPart.

Secondly, I think you are mixing things up. The ToolPartGetLists is not a toolpart, it is a webpart, that in itself loads the CustomToolPart, which in turn allows you to select a list. This toolpart is only shown when you edit the shared webpart in the UI. The list you select is then persisted to the SelectedList property of the webpart using the toolpart. The connected webpart then tries to read the SelectedList property I guess.

Like I said, I could go and try to fix the code for you, but it is not the way to go, you really (REALLY) need to switch to ASP.NET WebPart based webparts. The native sharepoint one WILL be fased out in the (near) future.

Here you can find an example, with code! (scroll to bottom for download link). As a bonus, it uses the built in sharepoint listpicker

Colin
I have to agree with Colin here, and certainly couldn't have said it as succinctly myself, since I don't customize SharePoint much.I do recall doing something much like this before by using a data view bound to a drop-down control for the name of its data source, and it didn't involve a lot of code, just plugging in the right properties in SP Designer. Maybe this page will be some help? http://msdn.microsoft.com/en-us/library/cc300163.aspx
ewall
Colin / ewall, Thanks a lot for your effort and the post you have pointed out is awesome! Anyways I could fix the code. I noticed that I can call the method to fill the regions and repeater control and it worked like miracle. Now I shall make use of you the post and modify the code.Thanks Cloin and ewall again for your effort.
Pradeep007
Colin - strongly worded! The microsoft.sharepoint.webpartpages.webpart is NOT deprecated and although you should use ASP.NET WebPart if possible there are situations where you would need to use the sharepoint version, seehttp://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.aspx
Ryan