如何显示在asp.net的通知 [英] How to display a notification in asp.net

查看:238
本文介绍了如何显示在asp.net的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示使用的通知的通知,但我不希望它会显示每一个页面加载的时间,但是当它只有东西给

 尝试
  mailCli​​ent.Send(邮件)
  ........
  '消息指的是存储字符串消息显示隐藏字段
  message.Value =消息发送。抓住EX为例外
  message.Value = ex.Message
结束Try

如果隐藏字段的值是空字符串不同,显示它有消息,否则什么也不显示。

 <脚本类型=文/ JScript的>
$(文件)。就绪(函数(){
如果($([ID $ = _消息])。VAL()!=){
  $ .easyNotification({
        文本:$([ID $ = _消息])VAL()。
      }
      );
     //设置隐藏字段的值,以空字符串
     $([ID $ = _消息])VAL()=。
    }});

正如你所看到的,我不是如何获得清晰/设置隐藏字段的值

修改 -----

我试着使用smokesignals。


  1. 新增的DLL到bin文件夹

  2. 把叫我的网页上plhMessages的占位符控制和

  3. 从我的网页的加载事件被称为SendMessage函数,但没有任何反应。 :(我缺少的东西???

ASP.Net

 <表ID =form1的=服务器>
        < ASP:面板ID =Panel1的=服务器>
            < ASP:占位符ID =plhMessages=服务器>
            < / ASP:占位符>
        < / ASP:面板>
< /表及GT;

VB

 保护小组btnSend_Load(BYVAL发件人为对象,BYVAL E上System.EventArgs)把手btnSend.Load
    SendMessage函数(MessageType.Error,这是从aspx页面设置错误信息。,真)
结束小组


解决方案

如果您使用.net我有我使用的显示信息库,的 smokesignals @ github上,真是简单和直接的。

I'm trying to display a notification using Easy Notification, but I don't want it to be displayed every time the page is loaded, but when it only has something to show

Try
  mailClient.Send(mail)
  ' ........      
  ' "message" is the hidden field that stores the string message to display
  message.Value = "Message sent."

Catch ex As Exception     
  message.Value = ex.Message
End Try

If the value of the hidden field is different from empty string, display the message it has , otherwise display nothing

<script type="text/jscript">  
$(document).ready(function() {
if ($("[id$=_message]").val()!=""){
  $.easyNotification({
        text: $("[id$=_message]").val()
      }
      );    
     //Set hidden field's value to empty string 
     $("[id$=_message]").val()="";
    }

});   

As you can see, I'm not clear on how to get/set the value of the hidden field

EDIT-----

I tried using smokesignals.

  1. Added the dll to the bin folder
  2. Put a placeholder control called plhMessages on my page and
  3. called SendMessage from the load event of my page,but nothing happens. :( Am I missing something???

ASP.Net

   <form id="form1" runat="server">
        <asp:Panel ID="Panel1" runat="server">
            <asp:PlaceHolder ID="plhMessages" runat="server">
            </asp:PlaceHolder>                
        </asp:Panel>
</form>

VB

Protected Sub btnSend_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Load
    SendMessage(MessageType.Error, "This is an error message set from the aspx page.", True)
End Sub

解决方案

if your using .net I've got a library that I use for displaying messages, smokesignals@github, really simple and straight forward.

这篇关于如何显示在asp.net的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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