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);
}
}
}