step1:
( please download the jquery file mentioned above)(for my reference i am using this link (Click here to download source code
$(function () {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: <%=listTitleStr %>
});
});
in .cs file refer this
public string listTitleStr { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
using (SPSite site = new SPSite(SPContext.Current.Site.ID))
{
using (SPWeb we = site.OpenWeb(SPContext.Current.Web.ID))
{
StringBuilder x = new StringBuilder();
x.Append("[");
foreach (SPListItem item in we.Lists["Document Types"].Items)
{
x.Append(string.Format("\"{0}\", ",item["Title"].ToString()));
}
listTitleStr = x.ToString().Substring(0,x.ToString().Length-2)+"]";
}
}
}
No comments:
Post a Comment