我正在使用C#在后台使用asp.net网站。我希望能够更新页面上的asp:标签,可以说Page1.aspx。我希望根据其他文件夹中类(.cs)中某个函数的结果进行更新。这可能是behind.cs。更新另一页上的asp:标签?
behind.cs
*some other code is here*
bool correct = false;
try
{
if (_myConn.State == ConnectionState.Closed)
{
_myConn.Open();
myCommand.ExecuteNonQuery();
}
if (Convert.ToInt32(myCommand.Parameters["@SQLVAR"].Value) < 1)
{
"Invalid Login" // I want to be the text of lblMessage.Text
}
else
{
correct = true;
}
_myConn.Close();
}
catch (Exception ex)
{
"Error connecting to the database" // I want to be the text of lblMessage.Text
}
return correct;
page1.aspx这个
<asp:label runat="server" ID="lblMessage" cssClass="error"></asp:label>
如何更新在asp:从** behind.cs上page1.aspx这个*标签? ?
完美解释。非常感谢。 =] – HGomez90