WebPart and WebPartZones Usage

Discussion in 'ASP .Net Web Controls' started by karthick, Mar 22, 2006.

  1. karthick

    karthick Guest

    I am using the following layout for my pages.

    <asp:content>
    <asp:Wizard>
    </asp:Wizard>
    <HeaderTemplate>
    <asp:WebPartZone>
    <ZoneTemplate>
    <asp:gridview />
    </ZoneTemplate>
    </asp:WebPartZone>

    </HeaderTemplate>

    <WizardSteps>
    <%-- Method1 -->
    <asp:WizardStep>
    <asp:WebPartZone>
    <ZoneTemplate>
    <UC:usercontrol />
    </ZoneTemplate>
    </asp:WebPartZone>
    </asp:WizardStep>

    <%-- Method2 -->
    <asp:WizardStep>
    <asp:WebPartZone>
    <ZoneTemplate>
    <asp:panel>
    -- All the controls in the user control go here directly
    </asp:panel>
    </ZoneTemplate>
    </asp:WebPartZone>
    </asp:WizardStep>
    </WizardSteps>
    </asp:content>

    I have the above design in one of my pages.
    I need to get/set values, properties for my controls inside the
    webpartzone.

    Problem1: accessing the controls inside the webpartzones is pain in the
    neck.

    problem2: if i try to use a generic findcontrol and pass the
    wizard.controlscollection, webpartzone does not have the same behaviour
    for HasControls property. so i have to go into the zone.webparts
    collection and iterate under each webpart to get to my control.
    this will be a killer as far as performance is concerned.

    I am trying to make full use of web parts. Is there a easier way to
    "find" controls in wizard and in webpartZones? (both method1 and
    method2). Can webPartZones be used this way?

    any comments and suggestions for this approach are welcome. thanks!
     
    karthick, Mar 22, 2006
    #1
    1. Advertising

  2. karthick

    DWS Guest

    karthick,
    Override the wizzard find control method.
    Public Overrides Function FindControl(ByVal id As String) As
    System.Web.UI.Control
    If id = "DWSwz" Then
    Return zone
    Else
    Return MyBase.FindControl(id)
    End If
    End Function

    Good Luck
    DWS


    "karthick" wrote:

    > I am using the following layout for my pages.
    >
    > <asp:content>
    > <asp:Wizard>
    > </asp:Wizard>
    > <HeaderTemplate>
    > <asp:WebPartZone>
    > <ZoneTemplate>
    > <asp:gridview />
    > </ZoneTemplate>
    > </asp:WebPartZone>
    >
    > </HeaderTemplate>
    >
    > <WizardSteps>
    > <%-- Method1 -->
    > <asp:WizardStep>
    > <asp:WebPartZone>
    > <ZoneTemplate>
    > <UC:usercontrol />
    > </ZoneTemplate>
    > </asp:WebPartZone>
    > </asp:WizardStep>
    >
    > <%-- Method2 -->
    > <asp:WizardStep>
    > <asp:WebPartZone>
    > <ZoneTemplate>
    > <asp:panel>
    > -- All the controls in the user control go here directly
    > </asp:panel>
    > </ZoneTemplate>
    > </asp:WebPartZone>
    > </asp:WizardStep>
    > </WizardSteps>
    > </asp:content>
    >
    > I have the above design in one of my pages.
    > I need to get/set values, properties for my controls inside the
    > webpartzone.
    >
    > Problem1: accessing the controls inside the webpartzones is pain in the
    > neck.
    >
    > problem2: if i try to use a generic findcontrol and pass the
    > wizard.controlscollection, webpartzone does not have the same behaviour
    > for HasControls property. so i have to go into the zone.webparts
    > collection and iterate under each webpart to get to my control.
    > this will be a killer as far as performance is concerned.
    >
    > I am trying to make full use of web parts. Is there a easier way to
    > "find" controls in wizard and in webpartZones? (both method1 and
    > method2). Can webPartZones be used this way?
    >
    > any comments and suggestions for this approach are welcome. thanks!
    >
    >
     
    DWS, Mar 26, 2006
    #2
    1. Advertising

  3. karthick

    karthick Guest

    thanks for the reply. i will try that for sure. one thing that nagging
    my mind is that using any form of recursion or looping to find a
    control is gonna hit performance. just a thought.
     
    karthick, Apr 6, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    2,063
  2. anars
    Replies:
    0
    Views:
    367
    anars
    Jan 7, 2007
  3. Replies:
    0
    Views:
    345
  4. AHarwood
    Replies:
    0
    Views:
    124
    AHarwood
    Sep 27, 2006
  5. barry

    moving webpartzones

    barry, Feb 25, 2008, in forum: ASP General
    Replies:
    0
    Views:
    96
    barry
    Feb 25, 2008
Loading...

Share This Page