This is how my code looks like.
I want to kno why is the value in the label coming as blank or null.
I want to assign the value to username at get data and use it at the button click event.
Can some1 guide me with this and why is it happening and how to solve this issue
I don't want to use a session and static.
namespace GUI
{
public partial class Updatechild : System.Web.UI.Page
{
string UserName;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//CALL A FUNCTION TO GET THE VALUE
GetData();
}
}
protected void GetData()
{
//VALUE assigned
UserName= "USER1"
}
// button click event
protected void Button_Click(object sender, EventArgs e)
{
Label.Text = UserName; //value comes as blank.
}
}