AJAX游标- Sharepoint可视化web部件
AJAX Cursor - Sharepoint Visual Webpart
我正在创建一个自定义SharePoint 2010 webpart。
我是AJAX的新手,所以请帮助我。
谁能给我一个一步一步的步骤来做以下的事?
打开按钮点击:
-
禁用按钮
-
显示等待画面/等待动画/沙漏光标
-
做长工作。
-
在文本框中显示Job成功完成。
为了更容易理解,我把我的代码贴在下面:
下面是我的VisualWebPart。文件:
<%@ 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="VisualWebPart1.ascx.cs" Inherits="AE_Project_Form.VisualWebPart1.VisualWebPart1" %>
<style type="text/css">
.auto-style1 {
width: 26%;
height: 248px;
}
.wait{
cursor:wait;
}
</style>
<script type="text/javascript">
function ShowCursor() {
document.getElementById('btn_Submit').disabled = true;
$(this).addClass("wait");
}
</script>
<table class="auto-style1">
<tr>
<td class="auto-style4" colspan="2">
<asp:Button ID="btn_Submit" runat="server" OnClick="btn_Submit_Click" Text="Submit" Width="97px" Height="20px" />
</td>
</tr>
现在我的visualwebpart . asx .cs文件看起来像这样:
using System;
using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing;
using System.Data;
namespace AE_Project_Form.VisualWebPart1
{
[ToolboxItemAttribute(false)]
public partial class VisualWebPart1 : WebPart
{
public VisualWebPart1()
{
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
InitializeControl();
}
protected void Page_Load(object sender, EventArgs e)
{
this.btn_Submit.Attributes.Add("onClick", "ShowMessage()");
}
protected void btn_Submit_Click(object sender, EventArgs e)
{
//Do a long process including some Database updates etc...
//Just show a MSGBOX saying process completed
Type cstype = this.GetType();
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsStartupScriptRegistered(cstype, "PopupScript"))
{
String cstext = "alert('Successfully Added Project');";
cs.RegisterStartupScript(cstype, "PopupScript", cstext, true);
}
}
}
现在我想让web部件做的是,当一个按钮被点击:
禁用按钮并启动等待光标
做长数据库处理
长进程完成后显示进程完成消息框
但是发生的是按钮没有被禁用,也没有看到等待的光标。长处理器如预期的那样花费了很长时间,并且只显示最后的消息框。
我对Javascript c# web部件编码的理解是否错误?
我在这里得到了答案:http://social.msdn.microsoft.com/forums/en us/sharepointdevelopmentprevious/thread/09f6e65c - 5 - d8c - 4516 - 81 - f1 - f48c21d20ef0/?prof=required
请看Jack的最后回复…这对我有用,谢谢…
相关文章:
- web部件页SharePoint 2013中的Iframe
- JavaScript窗口.位置不;我不在内容编辑器Web部件中工作
- 分析sharepoint 2010 Web部件中的json
- 访问/更改同一页面上另一个Web部件中类的html
- 内容编辑器 Web 部件脚本不在 IE 11 中运行(如果开发人员工具处于打开状态,则运行)
- 多个 Web 部件 JavaScript 依赖项
- 如何使用 JavaScript 对象模型以编程方式将 SharePoint 客户端 Web 部件 (AppPart) 添
- 如何将简单的 jquery 滑块添加到 SharePoint 2010 Web 部件
- SharePoint Javascript (_sp) 不会在上载到客户端 Web 部件库的文件中运行
- 如何在 SharePoint Online 中为内容搜索 Web 部件创建排序/筛选
- 使用javascript在web部件页面中获取web部件HTML id
- Javascript:获取SharePoint Web部件-要在页面上显示的对象
- 当列表视图web部件为空时隐藏它们(SharePoint)
- Javascript小部件无法在Sharepoint web部件中工作
- 必应地图Web部件(Java脚本错误)
- 当用户滚动按钮时,如何滑动特定的web部件(HTML)
- Kentico:让一个web部件使用ajax重载另一个web部件
- SharePoint web部件自动刷新javascript事件
- SaveFileDialog使用c#禁用Sharepoint中的web部件按钮
- 为什么我不能从事件接收器调用Web部件(用户控件)中的公共方法?