MessageBox Example Not working
I am consistently getting errors within the below, from the MessageBox example online, when put into the code-behind.
Code:
protected void Button2_Click(object sender, AjaxEventArgs e)
{
Ext.Msg.Prompt("Name", "Please enter your name:", new JFunction { Fn = "showResultText" }).Show();
}
here is the error I am getting:
Code:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1526: A new expression requires () or [] after type
Source Error:
Line 124: protected void Prompt_Click(object sender, AjaxEventArgs e)
Line 125: {
Line 126: Ext.Msg.Prompt("Name", "Please enter your name:", new JFunction { Fn = "showResultText" }).Show();
Line 127: }
Line 128:
RE: MessageBox Example Not working
I spent the time to make a full .aspx code sample using the bits you posted above and it appears to work as expected.
RE: MessageBox Example Not working
As soon as I copy and paste the below into a clean aspx code-behind - intellisense blows up on {
protected void Button2_Click(object sender, AjaxEventArgs e)
{
Ext.Msg.Prompt("Name", "Please enter your name:", new JFunction { Fn = "showResultText" }).Show();
}</PRE>
RE: MessageBox Example Not working
I meet the same problem. Why?
Code:
protected void Save_Click(object sender, AjaxEventArgs e)
{
com.tsingdai.BLL.Label LabelBLL = new com.tsingdai.BLL.Label();
com.tsingdai.Model.Label label = new com.tsingdai.Model.Label();
if (this.LabelName.Text.Trim() == "")
{
Ext.Msg.Prompt("Status", "????????!.").Show();
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:????!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
if (this.U_GroupID.Text.Trim() == "")
{
Ext.Msg.Prompt("Status", "????????!.").Show();
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:????!!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
label.Label_Name = LabelName.Text.Trim();
int number = 0;
if (SeqNo.Text.Trim() == "")
{
number = LabelBLL.GetMaxSeqNo();
}
else
{
if (!int.TryParse(SeqNo.Text.Trim(), out number))
{
Ext.Msg.Prompt("Status", "?????????!.").Show();
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:?????!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
}
label.SeqNo = 0;
label.GroupID = Int32.Parse(U_GroupID.Text);
label.Description = Description.Text;
label.Extend_Field1 = "";
label.Extend_Field1 = "";
bool result = LabelBLL.Add(label);
if (result)
EventMessage.MessageBox(1, "????", string.Format("{1}ID({0})??!", ID, "??"), Icon_Type.OK, Common.GetHomeBaseUrl("List.aspx"));
else
EventMessage.MessageBox(1, "????", "??????,??????!", Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
RE: MessageBox Example Not working
I resolve the problem. You must return command when implement the "Ext.Msg.Prompt("Status", "????????!.").Show();"
Code:
protected void Save_Click(object sender, AjaxEventArgs e)
{
com.tsingdai.BLL.Label LabelBLL = new com.tsingdai.BLL.Label();
com.tsingdai.Model.Label label = new com.tsingdai.Model.Label();
if (this.LabelName.Text.Trim() == "")
{
Ext.Msg.Prompt("Status", "????????!.").Show();
return;
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:????!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}</PRE> if (this.U_GroupID.Text.Trim() == "")
{
Ext.Msg.Prompt("Status", "????????!.").Show();
return;
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:????!!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}</PRE> label.Label_Name = LabelName.Text.Trim();</PRE> int number = 0;
if (SeqNo.Text.Trim() == "")
{
number = LabelBLL.GetMaxSeqNo();
}
else
{
if (!int.TryParse(SeqNo.Text.Trim(), out number))
{
Ext.Msg.Prompt("Status", "?????????!.").Show();
return;
//EventMessage.MessageBox(2, "??????????", string.Format("{0}???:?????!", "????"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
}
label.SeqNo = 0;
label.GroupID = Int32.Parse(U_GroupID.Text);
label.Description = Description.Text;
label.Extend_Field1 = "";
label.Extend_Field1 = "";</PRE> bool result = LabelBLL.Add(label);</PRE> if (result)
EventMessage.MessageBox(1, "????", string.Format("{1}ID({0})??!", ID, "??"), Icon_Type.OK, Common.GetHomeBaseUrl("List.aspx"));
else
EventMessage.MessageBox(1, "????", "??????,??????!", Icon_Type.Error, "history.back();", UrlType.JavaScript);
}
</PRE>
RE: MessageBox Example Not working
Does the following thread help solve the problem, see http://forums.ext.net/showthread.php...ight=JFunction
Please see my response and example in the thread.