在event receiver中如何弹出一个类似winform中messagebox.show 的框?

那我要对用户显示一些错误信息或者提示信息怎么搞?

1.

如果是在ItemAdding或者其他进行时(ing)事件里面,可以使用HttpContext.Current.Response.Write("<script>alert('aaaa');</script>");

如果是在ItemAdded或者其他结束后(ed)事件里面,那就没招。因为这类事件是异步的,已经获取不到页面的HttpResponse。

2.

可以在event reciver 里控制转向错误页面。
http://www.c-sharpcorner.com/Blogs/4224/sharepoint-2010-event-handler-redirection-to-custom-error-pa.aspx

properties.Status = SPEventRecieverStatus.CancelWithRedirectUrl;
Properties.RedirectUrl = “/_layouts/MyBlog/CustomError.aspx"

 

public override void ItemAdding(SPItemEventProperties properties)

{

base.ItemAdding(properties);

string tite = properties.AfterProperties[“title”].ToString();

if(tite.Contains(“_”))

{

properties.Cancel = true;

properties.Status = SPEventRecieverStatus.CancelWithRedirectUrl;

Properties.RedirectUrl = “/_layouts/MyBlog/CustomError.aspx?errormessage =Inavlid

Title”;

}

}

3.

Create a application page called customerror.aspx and show the error message from the query string

 

 <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="Server">    <asp:Label ID="lblError" runat="server" > </asp:Label> </asp:Content>

4.

Add the following code in the page load

 

protected void Page_Load(object sender EventArgs e)

{

      lblError.Text = Request.Param[“Error”];

}

5.

function openAnswerQandADialog() {
  var options = {
  url: "/_layouts/QandA_PersonalAnswer.aspx",
  width: 600,
  height: 480,
  title: "个人QandA"
  };
  SP.UI.ModalDialog.showModalDialog(options);
  }
用js调用这个函数吧,这个是sharepoint自己带的函数,使用请在webpart中引用sharepoint命名控件啊。

Sharepoint 弹出消息提示框 .的更多相关文章

  1. 用PHP实现弹出消息提示框

    方法一: echo "<script>alert('提示内容')</script>"; 方法二: echo '<script language=&qu ...

  2. bootstrap添加模态窗后,再弹出消息提示框后,原先的滚动条消失

    设置需要滚动的模态框 overflow :scroll

  3. 弹出JS提示框

    弹出JS提示框Page.ClientScript.RegisterStartupScript(typeof(string), "msg", "<script> ...

  4. Asp.Net下载页面,并弹出下载提示框

    Asp.Net下载页面,并弹出下载提示框.在删除按钮里调用以下方法.

  5. 解决PL/SQL Dev连接Oracle弹出空白提示框

    第一次安装Oracle,装在虚拟机中,用PL/SQL Dev连接远程数据库的时候老是弹出空白提示框,网上找了很久,解决方法也很多,可是就是没法解决我这种情况的. 没办法,只能自己研究,经过大概一天时间 ...

  6. IE中使用ajaxSubmit上传文件弹出下载提示框

    使用jQuery的ajaxSubmit 上传文件时,在IE中会弹出下载提示框: 解决方法:让action返回String类型,而不是ActionView,

  7. PL/SQL Dev连接Oracle弹出空白提示框的解决方法分享

    第一次安装Oracle,装在虚拟机中,用PL/SQL Dev连接远程数据库的时候老是弹出空白提示框,网上找了很久,解决方法也很多,可是就是没法解决我这种情况的. 出现这种问题,解决方法大概有这几种: ...

  8. asp.net导出excel并弹出保存提示框

    asp.net导出excel并弹出保存提示框 2013-07-12 | 阅:1  转:78   |  分享  腾讯空间 人人网 开心网 新浪微博 腾讯微博 搜狐空间 推荐给朋友 举报          ...

  9. [UWP]在应用退出时弹出确认提示框

    1. 需求 在应用退出时(点击右上角的关闭按钮)弹出一个确认按钮可以说是一个最常见的操作了,例如记事本的"你是否保存": 但这个功能在UWP上居然有点小复杂.这篇文章将解释如何实现 ...

随机推荐

  1. electron的艰难安装之旅

    最近对前端开发很感兴趣,抽空研究了下前段的开发工具,发现比较流行的是sublime,atom,vscode等, 由于一直以来从事.net开发所以对vscode很感兴趣,在vscode的安装配置过程偶然 ...

  2. Revenge of GCD HDU5019

    Description In mathematics, the greatest common divisor (gcd), also known as the greatest common fac ...

  3. JAVA: 接入YSDK遇到的问题

    JAVA后台接口: 1, 腾讯开放平台: http://wiki.open.qq.com/wiki/%E9%A6%96%E9%A1%B5 2,YSDK介绍,大概流程: http://wiki.open ...

  4. Qt 5.7 > QML

    本文档翻译自Qt官方文档: http://doc.qt.io/qt-5/qtqml-index.html Qt QML Qt QML模块使用QML语言为开发应用与库提供一个框架.它定义并实现了语言与引 ...

  5. Chapter 2 Open Book——25

    "My name is Edward Cullen," he continued. "I didn't have a chance to introduce myself ...

  6. Hack写法

    文章来源: http://www.w3cplus.com/css/create-css-browers-hacks 条件注释:http://www.w3cplus.com/create-an-ie-o ...

  7. iOS开发The Operation couldn't be completed.(LaunchServicesError error 0.)的解决方法

    显示错误:The Operation couldn't be completed.(LaunchServicesError error 0.)解决办法:第1种方法.点击当前的模拟器,点击IOS Sim ...

  8. POJ 2350 Above Average

    Description It is said that 90% of frosh expect to be above average in their class. You are to provi ...

  9. php 关联数组

    <?php header("content-type:text/html;charset=utf8");$fruit = array(    'apple'=>&quo ...

  10. jQuery动态添加元素事件

    在项目中遇到需要jQuery动态添加元素的事件,做了一个demo,方便以后遇到相同的问题可以用上: <!DOCTYPE html> <html> <head> &l ...