在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. 在SpringMVC的controller控制器中使用Servlet原生的API

    只需要在控制器的方法里添加相应的Servlet 参数即可! 支持以下参数: 新建一个controller类,部分代码如下:(省略xml配置文件) @RequestMapping("servl ...

  2. Ubuntu操作相关笔记

    Eclipse添加图标 #sudo vim /usr/share/applications/eclipse.desktop 写入以下内容 [Desktop Entry] Name=Eclipse Co ...

  3. 成都IT公司面经及公司评价

    从2015年年底到2016年初找了几个月工作,面了大大小小若干公司,有很不错的公司,也有很多坑公司,与君共勉. 1.科大讯飞 地址:成都分公司位于天府软件园E区,占一层楼.面积挺大.公司装修风格很舒服 ...

  4. android设置组件透明度

    textremind.setBackgroundColor(Color.argb(178, 0, 0, 0));  //背景透明度 textremind.setTextColor(Color.argb ...

  5. Javaweb 第15天 web练习和分页技术

    第15天 web练习和分页技术 复习day14内容: 学习新技术的思路? 分析功能的思路? 使用queryRunner操作数据库的步骤? ResultSetHandler接口常用实现类(三个重点)? ...

  6. 整屏滚动效果 jquery.fullPage.js插件+CSS3实现

    最近很流行整屏滚动的效果,无论是在PC端还是移动端,本人也借机学习了一下,主要通过jquery.funnPage.js插件+CSS3实现效果. 本人做的效果: PC端:http://demo.qpdi ...

  7. Hack写法

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

  8. win10应用UserControl

    <Grid xmlns:src="using:UserControlExample" Margin="0,50,0,0"> <Grid.Row ...

  9. Udemy - Angular 2 - The Complete Guide 笔记

    1. install > npm install -g angular-cli 2. create app > ng new first-app 3. build app > cd ...

  10. LeetCode OJ 35. Search Insert Position

    Given a sorted array and a target value, return the index if the target is found. If not, return the ...