Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 24th, 2003, 12:54 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default 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


  #2 (permalink)  
Old December 29th, 2003, 10:39 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

This turned out to be an issue with instanciating the user control. If anyone is interested I will go into more detail.

  #3 (permalink)  
Old March 7th, 2004, 05:17 PM
Registered User
 
Join Date: Mar 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to redgabber
Default

I have the same prb... how to solved ir ? thx

  #4 (permalink)  
Old March 8th, 2004, 10:32 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

I had to instanciate the object. At the top of the page, I put this:

    Protected WithEvents CMSMenuListBar1 As CMSMenuListBar

Then you can access methods and properties like any other control.

Hope this helps.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl in DataListItem SKhna ASP.NET 2.0 Basics 1 February 29th, 2008 05:15 PM
FindControl in nested repeater chrisk_47 .NET Framework 2.0 0 February 6th, 2007 10:45 PM
FindControl Wervis C# 7 November 30th, 2005 09:51 AM
FindControl dkr72 Excel VBA 0 January 19th, 2005 09:55 AM
Problem with FindControl RussC Excel VBA 1 June 16th, 2004 11:58 AM



All times are GMT -4. The time now is 03:29 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.