Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Microsoft ToolBar Webcontrol


Message #1 by "Kan Yu Ting" <yu-ting.kan@p...> on Sat, 22 Jun 2002 03:58:13
Dear all,

Anyone experience using Microsoft Toolbar control pls give me some 
suggestions.

I put the Toolbar control in a ascx file and want to change it's property 
at aspx Page_Load event. For example, I want to do in program to disable 
specify ToolBarCheckButton or set its image.

How can I do this in programming? I aleays get error for object and 
instance error?

Please help

Kan



 
Message #2 by "B SHIVAKUMAR" <skb@s...> on Mon, 24 Jun 2002 14:53:02 +0530
Hi Kan,

	you can access the toolbar controls by it's index. here is the example to
disable the first button.

	' Toolbar1 is my tool bar.

	Toolbar1.Items(0).Enabled = False

*Toolbar1.Items.Count - you will get the no of controls in the toolbar1.

cheers
premshiva

-----Original Message-----
From: Kan Yu Ting [mailto:yu-ting.kan@p...]
Sent: Saturday, June 22, 2002 3:58 AM
To: ASP+
Subject: [aspx] Microsoft ToolBar Webcontrol


Dear all,

Anyone experience using Microsoft Toolbar control pls give me some
suggestions.

I put the Toolbar control in a ascx file and want to change it's property
at aspx Page_Load event. For example, I want to do in program to disable
specify ToolBarCheckButton or set its image.

How can I do this in programming? I aleays get error for object and
instance error?

Please help

Kan





Message #3 by "Kan Yu Ting" <yu-ting.kan@p...> on Mon, 24 Jun 2002 11:41:30
 Hello 

Thanks for reply.  
I try this before by using Toolbar1.Items(0).Enabled = False and disable 
the button.

but my tool bar is in an ascx file and I want to disable it in the 
Page_load event of its hosting page(i.e. aspx.cs file)
I get the 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.

I can't solve it.Please help

Kan


> Hi Kan,

	you can access the toolbar controls by it's index. here is the 
example to
disable the first button.

	' Toolbar1 is my tool bar.

	Toolbar1.Items(0).Enabled = False

*Toolbar1.Items.Count - you will get the no of controls in the toolbar1.

cheers
premshiva

-----Original Message-----
From: Kan Yu Ting [mailto:yu-ting.kan@p...]
Sent: Saturday, June 22, 2002 3:58 AM
To: ASP+
Subject: [aspx] Microsoft ToolBar Webcontrol


Dear all,

Anyone experience using Microsoft Toolbar control pls give me some
suggestions.

I put the Toolbar control in a ascx file and want to change it's property
at aspx Page_Load event. For example, I want to do in program to disable
specify ToolBarCheckButton or set its image.

How can I do this in programming? I aleays get error for object and
instance error?

Please help

Kan





Message #4 by Neeta.Ambekar@l... on Mon, 24 Jun 2002 16:15:27 +0530
hi
following code might help you

E.g
Html page code

<%@Register TagName="DateControl" TagPrefix ="AMSDateCOntrol" src
="AMSDateControl.ascx" %>
<html>
......
<amsdatecontrol:datecontrol id="wcCircular" runat
="server"></amsdatecontrol:datecontrol>

</html>

code behind .vb file

    Protected WithEvents wcCircular As System.Web.UI.UserControl

private fun1()
        Dim objDateCntrl As AMSDateControl

        objDateCntrl = wcCircular
         'here GetDateValue is public funcation in Date COntrol user
control
        strDate = objDateCntrl.GetDateValue()

end fun1

regards
neeta

Message #5 by Feduke Cntr Charles R <FedukeCR@m...> on Mon, 24 Jun 2002 08:51:35 -0400
Kan,

	You will have to expose the ToolBar1 as a public class rather than
protected from your *.ascx:

public SomeToolBarClassName ToolBar1;

Then you can do:

userControl.ToolBar1.Items(0).Enabled = False

	Remember that when you make an *.ascx, all the controls on the
*.ascx are treated as if they are in their own little world and inaccessible
to outside code except the by the [code] interfaces that you create, whether
it is simply declaring an object instance public or tying individual
properties to the properties of controls within the UserControl.

HTH,
- Chuck

-----Original Message-----
From: Kan Yu Ting [mailto:yu-ting.kan@p...]
Sent: Monday, June 24, 2002 7:42 AM
To: ASP+
Subject: [aspx] RE: Microsoft ToolBar Webcontrol


 Hello 

Thanks for reply.  
I try this before by using Toolbar1.Items(0).Enabled = False and disable 
the button.

but my tool bar is in an ascx file and I want to disable it in the 
Page_load event of its hosting page(i.e. aspx.cs file)
I get the 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.

I can't solve it.Please help

Kan


> Hi Kan,

	you can access the toolbar controls by it's index. here is the 
example to
disable the first button.

	' Toolbar1 is my tool bar.

	Toolbar1.Items(0).Enabled = False

*Toolbar1.Items.Count - you will get the no of controls in the toolbar1.

cheers
premshiva

-----Original Message-----
From: Kan Yu Ting [mailto:yu-ting.kan@p...]
Sent: Saturday, June 22, 2002 3:58 AM
To: ASP+
Subject: [aspx] Microsoft ToolBar Webcontrol


Dear all,

Anyone experience using Microsoft Toolbar control pls give me some
suggestions.

I put the Toolbar control in a ascx file and want to change it's property
at aspx Page_Load event. For example, I want to do in program to disable
specify ToolBarCheckButton or set its image.

How can I do this in programming? I aleays get error for object and
instance error?

Please help

Kan






  Return to Index