Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Derived compound controls

Reply
Thread Tools

Derived compound controls

 
 
Donald Welker
Guest
Posts: n/a
 
      08-19-2004
I have a form with various contols, each of which I want to have a View Panel
and an Edit Panel. I created a base class in TRControl.ascx.vb (there is a
TRControl.ascx that contains one line: <%@ Control Language="vb"
AutoEventWireup="false" Codebehind="TRControl.ascx.vb"
Inherits="CMSearch00.TRControl"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> ):

Public MustInherit Class TRControl
Inherits System.Web.UI.UserControl
....
Protected WithEvents pnlView As System.Web.UI.WebControls.Panel ' must
be templated or generated in each instance
Protected WithEvents pnlEdit As System.Web.UI.WebControls.Panel ' must
be templated or generated in each instance
....
Public Property View() As Boolean
Get
Return pnlView.Visible
End Get
Set(ByVal Value As Boolean)
pnlView.Visible = Value
End Set
End Property ' View

Public Property Edit() As Boolean
Get
Return pnlEdit.Visible
End Get
Set(ByVal Value As Boolean)
pnlEdit.Visible = Value
End Set
End Property ' Edit
....

Now I derive a particular user control from this in TRLineItem.ascx.vb:
Public MustInherit Class TRLineItem
Inherits TRControl
....
and I created pnlEdit and pnlView in TRLineItem.ascx but did not declare
them here.

These controls are referenced from TransReq.aspx.vb, which tries to set
their states from Page_PreRender by calling:
Private Sub dbgTurnOnTRControls(ByRef cc As ControlCollection)
' Turns on all controls, used only for debugging
Dim C As Control
For Each C In cc
If TypeOf (C) Is TRControl Then
CType(C, TRControl).Mode = TRControl.FormModes.Both
CType(C, TRControl).Edit = True ' debug
CType(C, TRControl).View = True
End If
If c.HasControls Then dbgTurnOnTRControls(c.Controls) ' recurse
Next ' C
End Sub ' dbgTurnOnTRControls

When I run this, the code executes but the Edit/View panels' Visible
properties are left in their initial states of False. Stepping through the
code I see the method entered in TRControl.aspx.vb but the actual state does
not change after the assignment. What am I doing wrong?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Derived Structure in Derived Class?? David C++ 3 01-29-2008 07:38 AM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 01:44 PM
Derived::Derived(const Base&) developereo@hotmail.com C++ 4 05-23-2007 09:32 AM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 12:07 AM
RE: Compound Control event not firing, but only when it's in a library =?Utf-8?B?TWlrZUw=?= ASP .Net 0 11-19-2004 04:45 AM



Advertisments