摘要:八種提示視窗
Code來源: http://examples1.ext.net/#/MessageBox/Basic/Overview/
1.Confirm 確認視窗
C#
X.Msg.Confirm("視窗標題", "視窗文字內容", new JFunction { Fn = "showResult" }).Show();
Javascript
<script type="text/javascript">
var showResult = function (btn) {
Ext.Msg.notify("Button Click", "You clicked the " + btn + " button");
};
</script>
2.Prompt視窗:可輸入文字,出現提示
C#
X.Msg.Prompt("Name", "Please enter your name:", new JFunction { Fn = "showResultText" }).Show();
Javascript
<script type="text/javascript">
var showResultText = function (btn, text) {
Ext.Msg.notify("Button Click", "You clicked the " + btn + 'button and entered the text "' + text + '".');
};
</script>
3.多行Prompt視窗:可輸入文字,出現提示
C#
X.Msg.Show(new MessageBoxConfig
{
Title = "Address",
Message = "Please enter your address:",
Width = 300,
Buttons = MessageBox.Button.OKCANCEL,
Multiline = true,
AnimEl = this.Button3.ClientID,
Fn = new JFunction { Fn = "showResultText" }
});
Javascript
<script type="text/javascript">
var showResultText = function (btn, text) {
Ext.Msg.notify("Button Click", "You clicked the " + btn + 'button and entered the text "' + text + '".');
};
</script>
4.Yes/No/Cancel
C#
X.Msg.Show(new MessageBoxConfig
{
Title = "Save Changes?",
Message = "You are closing a tab that has unsaved changes. <br />Would you like to save your changes?",
Buttons = MessageBox.Button.YESNOCANCEL,
Icon = MessageBox.Icon.QUESTION,
Fn = new JFunction { Fn = "showResult" },
AnimEl = this.Button4.ClientID
});
Javascript
<script type="text/javascript">
var showResult = function (btn) {
Ext.Msg.notify("Button Click", "You clicked the " + btn + " button");
};
</script>
5.Progress 進度視窗
C#
X.Msg.Show(new MessageBoxConfig
{
Title = "Please wait",
Message = "Loading items...",
ProgressText = "Initializing...",
Width = 300,
Progress = true,
Closable = false,
AnimEl = this.Button5.ClientID
});
this.StartLongAction();
private void StartLongAction()
{
this.Session["Task1"] = 0;
ThreadPool.QueueUserWorkItem(LongAction);
this.TaskManager1.StartTask("Task1");
}
private void LongAction(object state)
{
for (int i = 0; i < 10; i++)
{
Thread.Sleep(1000);
this.Session["Task1"] = i + 1;
}
this.Session.Remove("Task1");
}
6.Wait 視窗:適合用於上載檔案時
X.Msg.Show(new MessageBoxConfig
{
Message = "Saving your data, please wait...",
ProgressText = "Saving...",
Width = 300,
Wait = true,
WaitConfig = new WaitConfig { Interval = 200 },
IconCls = "ext-mb-download",
AnimEl = this.Button6.ClientID
});
this.ResourceManager1.AddScript("setTimeout(function () { Ext.MessageBox.hide(); Ext.Msg.notify('Done', 'Your data was saved!'); }, 8000);");
7.Alert提示視窗
C#
X.Msg.Alert("Status", "Changes saved successfully.", new JFunction { Fn = "showResult" }).Show();
Javascript
<script type="text/javascript">
var showResult = function (btn) {
Ext.Msg.notify("Button Click", "You clicked the " + btn + " button");
};
</script>
8.Icons:帶有不同Icon的Alert視窗
不同位置的提示視窗彈出
http://examples1.ext.net/#/MessageBox/Notification/Client-Side_Notification/