Button click not working in MOSS 2007

Rate It (1)

Last post 01-28-2009 4:49 AM by Hong-Gang Chen - MSFT. 3 replies.

Sort Posts:

  • Button click not working in MOSS 2007

    01-23-2009, 6:00 AM
    • Member
      point Member
    • rupesh.pote
    • Member since 01-23-2009, 10:48 AM
    • pune
    • Posts 2

    Hi,

    I m new bee in MOSS and create sample apps simple with 3 text box and submit button on click on that button,Text Box3  = Textbox1 + textbox2

    OR  Text Box3  = Textbox1 - textbox2

    but my button click event is not fired ...................................

    I go through net searched , copy code but.................. Nothing 

    Could you experts Plz help me 

    My code is here plz check 

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SharePoint;
    using Microsoft.SharePoint.WebControls;
    using Microsoft.SharePoint.Portal;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;



    namespace CRMAPP
    {


        public class CRMAPP : Microsoft.SharePoint.WebPartPages.WebPart
        {
                    TextBox tbA;
            TextBox tbB;
            TextBox tbResult;
            Button btnAdd;
            Button btnSub;
            protected override void CreateChildControls()
            {
                tbA = new TextBox();
                tbB = new TextBox();
                tbResult = new TextBox();
                btnAdd = new Button();
                btnSub = new Button();
                tbResult.ReadOnly = true;
                btnAdd.Text = "+";
                btnSub.Text = "-";
                btnAdd.Click += new EventHandler(btnAdd_Click);
                btnSub.Click += new EventHandler(btnSub_Click);
                this.Controls.Add(tbA);
                this.Controls.Add(new LiteralControl("<br>"));
                this.Controls.Add(tbB);
                this.Controls.Add(new LiteralControl("<br>"));
                this.Controls.Add(btnAdd);
                this.Controls.Add(btnSub);
                this.Controls.Add(new LiteralControl("<br>"));
                this.Controls.Add(tbResult);
            }
            void btnAdd_Click(object sender, EventArgs e)
            {
                int a = int.Parse(tbA.Text);
                int b = int.Parse(tbB.Text);
                int c = a + b;
                tbResult.Text = c.ToString();
            }
            void btnSub_Click(object sender, EventArgs e)
            {
                int a = int.Parse(tbA.Text);
                int b = int.Parse(tbB.Text);
                int c = a - b;
                tbResult.Text = c.ToString();
            }
            protected override void Render(HtmlTextWriter writer)
            {
                this.EnsureChildControls();

                tbA.RenderControl(writer);
                writer.Write("<br>");
                tbB.RenderControl(writer);
                writer.Write("<br>");
                btnAdd.RenderControl(writer);
                btnSub.RenderControl(writer);
                writer.Write("<br>");
                tbResult.RenderControl(writer);
            }

        }

        
    }

  • Re: Button click not working in MOSS 2007

    01-23-2009, 7:59 AM
    • Member
      2 point Member
    • Rajendra.Raj
    • Member since 01-23-2009, 12:57 PM
    • Posts 1

    Hello Rupesh, I think you need to start the Event Handler Service on the Central Manager Configuration setting and also do start the Windows Search Service. Please Mark as solved solution if the issue is solved..

     

    Thanks

  • Re: Button click not working in MOSS 2007

    01-28-2009, 4:49 AM
    Hong-Gang Chen
    Microsoft Online Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (4 items)