Hi, i'm trying to do an insert using the objectdatasource control to call my method in the bll. The problem i have is handling the return type. In my code behind i have the following:
This works fine if the return value is true (it redirects back to the documents folder in the admin area). However when i encounter a problem the contents of the lblSummary are not updated. By default i set its visible property to false and then hope to make it visible but it will not show. Appreciate if someone could tell me what i am doing wrong. Thanks
Code:
protected void objUser_Inserted(object sender, System.Web.UI.WebControls.ObjectDataSourceStatusEventArgs e) {
if ((bool) e.ReturnValue == true) {
Response.Redirect("~/Admin/Documents/");
} else {
Label lblSummary = (Label) fvwUser.FindControl("lblSummary");
lblSummary.Text = "Error: Username already exists";
lblSummary.Visible = true;
}
}
This works fine if the return value is true (it redirects back to the documents folder in the admin area). However when i encounter a problem the contents of the lblSummary are not updated. By default i set its visible property to false and then hope to make it visible but it will not show. Appreciate if someone could tell me what i am doing wrong. Thanks