我有一个名为EmployeeInformation.aspx.cs的用户控件类,带有Textfield txtRegistrationNo
public partial class EmployeeInformation : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string TextRegistrationNo
{
get
{
return txtRegistrationNo.Text;
}
}
}
现在在另一个名为SeparationInfo.aspx.cs的类中,如何访问txtRegistrationNo字段?
答案 0 :(得分:0)
您必须通过自定义控件的对象访问它,假设EmployeeInformation
的实例为EmployeeInformation1
string TextRegistrationNo = EmployeeInformation1.TextRegistrationNo;
答案 1 :(得分:0)
EmployeeInformation objEmployeeInfo = new EmployeeInformation();
string temp = objEmployeeInfo.TextRegistrationNo;