FindControl Method problem
Hello all, Happy Holidays
This is what I have.
I have a Usercontrol(.ascx) with 1 control on it. (this is a third party control for a menu) it is called CMSMenuListBar.ascx. The control is named "uwlbCMSMenu"
in my aspx page I want to set some properties of this control (uwlbCMSMenu)
This is my code
Protected WithEvents CMSMenu As CMSMenuListBar
PageLoad:
Dim x As Infragistics.WebUI.UltraWebListbar.UltraWebListbar
x = CMSMenu.FindControl("uwlbCMSMenu")
x.SelectedGroup = 1
I complile and run, but keep getting this error:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 125: Dim x As Infragistics.WebUI.UltraWebListbar.UltraWebListbar
Line 126: ' x = CType(CMSMenu.FindControl("uwlbCMSMenu"), Infragistics.WebUI.UltraWebListbar.UltraWebListbar )
Line 127: x = CMSMenu.FindControl("uwlbCMSMenu")
Line 128: x.SelectedGroup = 1
Line 129:
Line 127 is hightlighted as the error.
It seems like it is not finding that control, but that is the correct name. Am I missing something? Am I doing something wrong?
Any help would be appreciated.
Thanks,
Jim
|