Error Message displayed as "AddFavoriteRadWindow not found"
My code:
protected void btnAddReport_Click(object sender, ImageClickEventArgs e)
{
this.form1.Controls.Add(AddFavoriteRadWindow); // working fine
}
protected void btnOk_Click(object sender, EventArgs e)
{
if (txtReportFavorite.Text != string.Empty)
{
// code for inserting into db..
AddFavoriteRadWindow.Visible = false; // not working
}
}
“AddFavoriteRadWindow not found” message is displayed when I want to hide the rad window
You need to get the instance of your added controls from your Control Collection. Try
You may put a check in place against null. Something like.
(I am not sure about your class name, I have used
RadWindowbut you can replace that with your class name)EDIT: You should pass the string
idof the control in your FindControl method to get that specific control back