【发布时间】:2012-03-29 19:54:47
【问题描述】:
虽然这个论坛有很多jquery自动完成代码。但是,我没有找到适合我的 SharePoint/ASP.NET 网页案例的任何内容。我关注了jquery autocomplete link。这很有帮助。但是请看
我的代码:
<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("asp:TextBox#TextBox3").autocomplete({
source: ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby"]
});
});
</script>
</asp:Content>
<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
<table>
<tr><td>
<asp:Label ID="Label4" runat="server" Text="Qode"></asp:Label></td><td>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td></tr>
</table>
问题
1. Can I use the code ` $("asp:TextBox#TextBox3")?`
2. If the source comes from code behind instead of hard copy strings, how to do it?
让我们在后面的代码中说:
string[] source = new string[5];
source[0] = "c++";
source[1] = "java";
source[2] = "php";
source[3] = "coldfusion";
source[4] = "javascript";
那么如何将数组传递给jquery代码呢? 非常感谢。
【问题讨论】:
标签: c# jquery asp.net jquery-ui sharepoint