hello , adv thanks for those who addresses to my problem.first of all i designed the webform in design mode and wrote this logic for buttons in aspx.cs code window.my intention is accepting 1 integer 1string and 1 integer..through 3 textboxes then store the content from the textboxes with the help of textboxids to variables called a,b,c .i declared them as public in class form. & a button click method called accept .the data succesfully storing in a,b,c variables without any problem with in the scope of accept click button method but when the display method is invoking(inother words when i click the display button to retrieve stored content) i cannot able to get the stored content from the variables.its printing null values. can anyone help me on this.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace empdet2example
{
public partial class EmpForm1 : System.Web.UI.Page
{
public int a;
public string b;
public int c;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAccept_Click(object sender, EventArgs e)
{
if (textboxEmpNo.Text == "" || textboxEname.Text=="" || textboxSal.Text=="" )
{
lblMssg.Text="Invalid Data";
return;
}
else
a = Convert.ToInt32(textboxEmpNo.Text);
b = textboxEname.Text;
c = Convert.ToInt32(textboxSal.Text);
lblMssg.Text=null;
lblMssg2.Text="Entered Values Are Accepted Successfully !";
textboxEmpNo.Text = null;
textboxEname.Text = null;
textboxSal.Text = null;
}
protected void btnDisp_Click(object sender, EventArgs e)
{
if (a == 0 && b == "" && c == 0)
{
Response.Write("No Data Stored");
return;
}
else
lblEN.Text = "Entered Emp No is :" + a;
lblEName.Text = "Entered Emp Name is:" + b;
lblSal.Text = "Entered Emp Salary is :" + c;
lblMssg2.Text = null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace empdet2example
{
public partial class EmpForm1 : System.Web.UI.Page
{
public int a;
public string b;
public int c;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnAccept_Click(object sender, EventArgs e)
{
if (textboxEmpNo.Text == "" || textboxEname.Text=="" || textboxSal.Text=="" )
{
lblMssg.Text="Invalid Data";
return;
}
else
a = Convert.ToInt32(textboxEmpNo.Text);
b = textboxEname.Text;
c = Convert.ToInt32(textboxSal.Text);
lblMssg.Text=null;
lblMssg2.Text="Entered Values Are Accepted Successfully !";
textboxEmpNo.Text = null;
textboxEname.Text = null;
textboxSal.Text = null;
}
protected void btnDisp_Click(object sender, EventArgs e)
{
if (a == 0 && b == "" && c == 0)
{
Response.Write("No Data Stored");
return;
}
else
lblEN.Text = "Entered Emp No is :" + a;
lblEName.Text = "Entered Emp Name is:" + b;
lblSal.Text = "Entered Emp Salary is :" + c;
lblMssg2.Text = null;
}
}
}