Geeks With Blogs
Scott Spradlin Developer Community Enthusiast

So there I was -- another day of writing slick AJAXified custom SharePoint web parts.  This was a simple one.  A series of dropdowns that cause subsequent dropdowns to be re-populated with increasingly restrictive data.

  • Planet
  • Continent
  • Country
  • etc.

But, when I changed the planet choice to be "Earth" the continent choice DID populate with the continents on earth but it caused a complete page round trip -- not the smooth AJAXified action I expected.  Plus, my UpdateProgress panel wasn't being displayed at all, even though I put a 10 second pause in my event handler.  What's wrong?  I'm comparing my CreateChildControls against previous similar projects that worked in the past and everything appears to be correct.

Can't figure it out so I start randomly moving things around to see what effect that has.  (Highly technical debugging technique.)  I move a button up into the UpdatePanel and THAT WORKS!  It's the dropdown!  AJAX hates my dropdowns!

I start looking into why it's so.  Do I need to specify the <TRIGGER> manually for these controls?  Say it ain't so!  I've never had to do that in the past.  Wait, someone's post says "make sure you give your dynamically created controls an ID or AJAX won't work for them!"  I add a line similar to:

      MyDropdownControl.ID = "_AnIdHere_"

...and by golly now it works.  Moral of the story?  Always give your dynamically created controls a proper ID.  Just like Norm, web parts want to go -- wait for it -- where everybody knows their name.

Technorati Tags: ,,
Posted on Thursday, July 10, 2008 7:49 PM SharePoint | Back to top


Comments on this post: SharePoint Custom Web Parts from Cheers (The TV Show)

# re: SharePoint Custom Web Parts from Cheers (The TV Show)
Requesting Gravatar...
was wondering if yo worked with Ajax webparts with custom tool part or editor part and being able to access those custom properties during your ajax call back
Left by bazztrap on Jul 11, 2008 6:03 AM

# re: SharePoint Custom Web Parts from Cheers (The TV Show)
Requesting Gravatar...
I've not worked with that specific scenario. Do you have more details of what's wrong?
Left by Scott Spradlin on Jul 11, 2008 9:29 AM

Your comment:
 (will show your gravatar)


Copyright © Scott Spradlin | Powered by: GeeksWithBlogs.net