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);



No comments: