この単純なJQuery関数をsharePointFoundationで起動するようにすることはできません。
ステップ1:jquery-1.4.1.jsファイルをSiteAssetsに追加します
ステップ2:WebファームソリューションでビジュアルWebパーツを作成します。
ステップ3:以下のコードを追加します
ステップ4:サーバーにWebパーツをデプロイします(jquery以外の機能が機能しているため成功します)。
ステップ5:しかし、jquery機能は機能していません。
これがWebパーツのすべてのコードです
WebPart1.ascx
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SanctuaryVisualWebPartUserControl.ascx.cs" Inherits="SanctuaryVisualWebPart.SanctuaryVisualWebPart.SanctuaryVisualWebPartUserControl" %>
<%@ Register assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.WebControls" tagprefix="asp" %>
<SharePoint:ScriptLink ID="ScriptLink1" runat="server" name="~sitecollection/SiteAssets/jquery-1.4.1.js " />
<style type="text/css">
.style1
{
width: 100%;
height: 247px;
}
.style2
{
width: 398px;
}
.style3
{
width: 421px;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
alert("Fired using JQuery Document ready");
$("#btnJQ").click(function () {
$("#tboxJQ").val("Fired using JQuery");
alert("Fired using JQuery");
});
});
</script>
<table bgcolor="#CCFFCC" border="3" cellpadding="3" cellspacing="3"
class="style1">
<tr>
<td>
<asp:Button ID="btnJQ" runat="server" Text="JQuery" Width="110px" />
</td>
<td>
<asp:TextBox ID="tboxJQ" runat="server"></asp:TextBox>
</td>
</tr>
</table>
ステップ6:document.readyからの最初のアラートは発生しますが、buttonClick内からの次のアラートは発生しません。
どんな助けでも大歓迎です