显示在ASP.NET消息框或确认框的最佳途径 [英] Best way of displaying a Message box or Confirmation box in ASP.NET

查看:89
本文介绍了显示在ASP.NET消息框或确认框的最佳途径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我碰到的要求来像日常消息框,因为一年左右,现在,我尝试jQuery插件,JavaScript的警报,但现在还不能确定哪一种方式是做的最好的方法。

我要显示ASP.NET页面(以及它的实际SharePoint应用程序页)。

中的消息框

 <%@页面语言=C#的MasterPageFile =〜/ _layouts / ABC / simple.master继承=Microsoft.SharePoint.WebControls.LayoutsPageBase%GT;
<%@大会名称=Microsoft.SharePoint.ApplicationPages,版本= 12.0.0.0,文化=中性公钥= 71e9bce111e9429c%GT;
<%@导入命名空间=Microsoft.SharePoint.ApplicationPages%GT;
<%@注册标签preFIX =的SharePoint命名空间=Microsoft.SharePoint.WebControls大会=Microsoft.SharePoint程序,版本= 12.0.0.0,文化=中性公钥= 71e9bce111e9429c%GT;
<%@注册标签preFIX =工具命名空间=Microsoft.SharePoint.Utilities大会=Microsoft.SharePoint程序,版本= 12.0.0.0,文化=中性公钥= 71e9bce111e9429c%GT;
<%@导入命名空间=Microsoft.SharePoint程序%>
<%@导入命名空间=系统的%><脚本=服务器>    保护无效的Page_Load(对象发件人,EventArgs的发送)
    {
        字符串= AA(Request.UrlReferrer.ToString());
        串B = BB(Request.UrlReferrer.ToString());        毫米(A,B);        乌里UU = Request.UrlReferrer;
        如果(UU!= NULL)
            的Response.Redirect(uu.ToString());        System.Web.HttpContext.Current.Response.Write(警报(\\这里写你想要什么\\));
    }

现在它不工作,但它可能是一些语法错误,但如果我想显示适当的消息框(如jQuery的插件的 http://docs.jquery.com/UI/Dialog 的方式,它不会做刷新页面)我能做些什么。

我是什么实际开发是一个自定义操作的SharePoint文档库。


  

修改


  
  

什么,我已经解释过总结是SharePoint 2007年,我
  必须开发/设计或使用消息框插件code最落后
  倍(服务器端),例如在C#ASP.NET背后code。现在我看到
  几十问题要求的,但其中的非实际上给人一种
  按照最佳做法恰当的解释。



解决方案

您不能提高服务器的一个消息。你必须写code所以需要在客户端HTML + JS提高警觉。如果你需要一些确认页面,你需要建立页面,并发布结果返回,当用户preSS YES或NO

I came across requirement for message box like everyday since around a year now, I tried jQuery plugins, JavaScripts alert but am still not sure which way would be the best way of doing it.

I want to display a message box within ASP.NET Page (well its actually sharepoint application page).

<%@ Page Language="C#" MasterPageFile="~/_layouts/abc/simple.master"  Inherits="Microsoft.SharePoint.WebControls.LayoutsPageBase" %>
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%> 
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %> 
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="System" %>

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        string a= aa(Request.UrlReferrer.ToString());
        string b= bb(Request.UrlReferrer.ToString());

        mm(a, b);

        Uri uu= Request.UrlReferrer;
        if (uu!= null)
            Response.Redirect(uu.ToString());

        System.Web.HttpContext.Current.Response.Write("alert(\"write here what you want\")");
    }

Now it doesn't work but it could be some syntax error but what If I want to display a proper message box(e.g. jquery's plugin http://docs.jquery.com/UI/Dialog in a way that it doesn't do refresh to page) what can I do.

what am actually developing is a Custom Action for SharePoint Document Library.

EDIT

Summary of what I already explained is in SharePoint 2007 I have to develop/design or use message box plugins code behind most times (server-side) e.g. in ASP.NET code behind with C#. Now I seen tens of question asking for that but non of them are actually giving a proper explanation in accordance to best practices.

解决方案

You can't raise a MessageBox in the server. You must write the code so the client HTML+JS raise the alert when needed. If you need some confirmation page, you need to build the page and post the results back when the user press YES or NO

这篇关于显示在ASP.NET消息框或确认框的最佳途径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆