I have two usercontrol U1 and U2. Now in U1 i have one override method(void Commit()
) and one public string property(NewCompanyID
). From U2 i have to call U1 commit()
method and inside the commit method i have to set the NewCompanyID
public property.
Code are as follows :
U2 code
//some code
obj.Commit();
CompanyId = obj.NewCompanyID;
U1 Code
public string NewCompanyID
{
get
{
if (string.IsNullOrEmpty(Convert.ToString(ViewState["NewCompanyId"])))
return string.Empty;
return Convert.ToString(ViewState["NewComapnyId"]);
}
set
{
ViewState["NewCompanyId"] = value;
}
}
public override void Commit()
{
// Some code
NewCompanyID = results.Entity.Id.ToString();
}
In Output NewCompanyID
is returning blank.