如何在vb.net中使用css进行消息框警报.. [英] how to use css for messagebox alert in vb.net..

查看:72
本文介绍了如何在vb.net中使用css进行消息框警报..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,这是我在vb.net中用于messagealert的函数...



  Imports  Microsoft.VisualBasic 
命名空间 Amit
Public Messagebx
公开 共享 Sub 警报( ByVal cont As Web.UI.Control, ByVal msg As String
Dim scrpt As String = 字符串 .Format( alert( '{0}');,msg)
ScriptManager.Re gisterStartupScript(续,续。 GetType (), Myscript ,scrpt, True

结束 Sub
结束
结束 命名空间









它显示正常的消息框..我想使用一些msgbox css使它时尚..我怎么能在该代码中使用css。或使用样式。

解决方案

您可以使用jquery ui对话框为时尚对话框添加jquery和jquery UI与css。

代码如下:



在javascript中创建这样的方法和

函数ShowAlert(消息){


#dialog)。html (message);


#dialog)。对话框({
模态: true
title: 状态
});
}



在Codebehind中:

  string  message =  在此设置消息; 
Page.ClientScript.RegisterStartupScript( this .GetType(), 弹出 ShowAlert(' + message + '); true );


sir, here is my function that i am using for messagealert in vb.net...

Imports Microsoft.VisualBasic
Namespace Amit
    Public Class Messagebx
        Public Shared Sub Alert(ByVal cont As Web.UI.Control, ByVal msg As String)
            Dim scrpt As String = String.Format("alert('{0}');", msg)
            ScriptManager.RegisterStartupScript(cont, cont.GetType(), "Myscript", scrpt, True)

        End Sub
    End Class
End Namespace





it is show a normal messagebox.. i want to use some msgbox css to make it stylish.. how can i use css in that code. or use style.

解决方案

Instead of writing alert you can use jquery ui dialog for stylish dialog box for this add jquery and jquery UI with css.
Code is below:

create a method like this in javascript and

function ShowAlert(message) {


("#dialog").html(message);


("#dialog").dialog({ modal: true, title: "Status" }); }


In Codebehind :

string message = "Set Message Here";
Page.ClientScript.RegisterStartupScript(this.GetType(), "popup", "ShowAlert('" + message + "');", true);


这篇关于如何在vb.net中使用css进行消息框警报..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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