Monday, February 18, 2008

Server Control ID Needed in Sharepoint

When working with a AutoComplete enabled Textbox in Sharepoint we found the need to capture the Server Control Id to send the value of the TextBox to the Search People Results Web Part. This way we could incorporate the existing People Search Core Results web part to work with out Ajax Enabled Custom Search Web part. We had to register the javascript code on the webpart capture the Web Parts Text value but the Key was to make sure and capture the TextBox Server Side Id in our JavaScript just like Ajax does.


// Javascript registered in WebPart to Capture ClientID - generated by ASP.NET

var test = document.getElementById('" + Text1.ClientID + "');alert(test.value);



Thursday, February 14, 2008

Sharepoint Custom Web Part with Ajax AutoComplete

After days of frustration and following simple how-to videos which didn't quite work we were finally able to achieve creating a Custom Sharepoint 2007 WebPart that implements Asp.Net 2.0 Ajax AutoComplete Control Extender functionality. The steps and and advice we used to get this WebPart up and running are listed below. I would like to give extra credit to "Peter ebSms" on TechNet who's helpful tip of adding to the _app_bin folder of your SharePoint sites virtual directory seems to have made all of the difference.

Download Asp.Net Ajax Extensions and the Ajax Toolkit from Asp.Net site
Update your Site's web config file.

Mike Ammerlaan's detailed updates to the Web.Config are right on and can be found at:
Implement Ajax in Sharepoint 2007

Deploy your Custom WebPart to Sharepoint
Pay close attention to this thread from Technet...especially Peter ebSms post. Props to Peter!!
TechNet Forum

**Tip**

Make sure to watch the version numbers on the web.config references to your Ajax dll's