MessageBox Example Not working

  1. #1

    MessageBox Example Not working

    I am consistently getting errors within the below, from the MessageBox example online, when put into the code-behind.

    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:

    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:
  2. #2

    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.

    Geoffrey McGill
    Founder
  3. #3

    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>
  4. #4

    RE: MessageBox Example Not working



    I meet the same problem. Why?
    
    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);
            }
  5. #5

    RE: MessageBox Example Not working

    I resolve the problem. You must return command when implement the "Ext.Msg.Prompt("Status", "????????!.").Show();"

        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>
  6. #6

    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.


    Geoffrey McGill
    Founder

Similar Threads

  1. [1.3] [2.0] No X.MessageBox from CodeBehind
    By ckarcz in forum 2.x Help
    Replies: 4
    Last Post: Mar 09, 2012, 4:59 PM
  2. Need Help : MessageBox setIcon() not working on Alert()
    By santhu12smart in forum 1.x Help
    Replies: 6
    Last Post: Dec 09, 2011, 12:10 PM
  3. MessageBox - Cannot get working from Example
    By Tbaseflug in forum 1.x Help
    Replies: 4
    Last Post: Jun 17, 2009, 5:24 PM
  4. Ext.MessageBox
    By dbassett74 in forum 1.x Help
    Replies: 3
    Last Post: May 26, 2009, 6:13 PM
  5. ExtJS MessageBox
    By jchau in forum 1.x Help
    Replies: 0
    Last Post: Oct 09, 2008, 10:30 AM

Posting Permissions