Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DNNTabStripsDNNTabStrips
Previous
 
Next
New Post
3/13/2007 8:30 AM
 
Hi!

I want to include a strip of tabs at the top of my module and I found the DNNtabstrips web control by Jon Henning (webcontrols.dotnetnuke.com/DNNTabStrip.aspx). However I'm not very comfortable with VB and I'm having trouble with converting the example code to C#, which is my prefered language.

I tried to search online for this, but I was unable to anything.

This is the code I'm having problems with:

Public Class TabStripRendering
  Inherits System.Web.UI.Page

  Public Enum TabRenderMode
    All
    Postback
    Callback
    PartialRendering
  End Enum

#Region "Member Variables"
  Private m_objInfo As PageInfo
  Private m_aryLocations() As String = {"Top", "Bottom", "Left", "Right"} 'used to show declarative databinding to dropdown
#End Region

#Region "Properties"

  'retrieves tabrendermode from querystring
  Public ReadOnly Property RenderMode() As TabRenderMode
    Get
      If Len(Request.QueryString("mode")) > 0 Then
        Return CInt(Request.QueryString("mode"))
      End If
      Return TabRenderMode.All
    End Get
  End Property

  'in order to simulate work we will use the sleep command throughout this example
  'encapsulating it in a property that checks the querystring allows it to be easily overridden
  Public ReadOnly Property DelayLength() As Integer
    Get
      If Len(Request.QueryString("delay")) > 0 Then
        Return CInt(Request.QueryString("delay"))
      End If
      Return 1000       'default to half a second
    End Get
  End Property

  'property to obtain the Id of the info object we are updating.  -1 means new
  Public ReadOnly Property DataId() As Integer
    Get
      If Len(Request.QueryString("id")) > 0 Then
        Return CInt(Request.QueryString("id"))
      End If
      Return -1
    End Get
  End Property

  'if id is passed on the querystring (DataId) then assume we are editing an existing record and pull the data
  'from the dataservice layer, otherwise we are assuming a new record, where the values are defaulted from
  'the Info's constructor
  Public ReadOnly Property PageData() As PageInfo
    Get
      If m_objInfo Is Nothing Then
        If DataId > -1 Then
          m_objInfo = DataServices.GetTabData(DataId)
        Else
          m_objInfo = New PageInfo
        End If
      End If
      Return m_objInfo
    End Get
  End Property

  'used to show declarative databinding to dropdown
  Public ReadOnly Property Locations() As String()
    Get
      Return m_aryLocations
    End Get
  End Property

#End Region

#Region "Event Handlers"
  'Technically this is only needed if we are using the callback rendering mode
  Protected Overrides Sub OnInit(ByVal e As System.EventArgs)
    MyBase.OnInit(e)
    'this is necessary to enable client callbacks.  If you coding inside DotNetNuke, this is NOT needed
    DotNetNuke.UI.Utilities.ClientAPI.HandleClientAPICallbackEvent(Me)
  End Sub

  Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    SetUpRenderMode()
    If Not Me.IsPostBack Then
      'since we are populating all tabs in initial load both of these functions could be changed to
      'InitializeControls and BindControls where both the tab controls and the non-tab controls
      'perform their respective logic.  However, I think it will be more helpful in comparing
      'if all pages utilize the same function names
      InitializeNonTabControls()
      BindNonTabControls()
    Else
      MethodCalled(">>> POSTBACK - Size: " & Me.Request.TotalBytes.ToString, False)

    End If

  End Sub

  Protected Sub tabGeneral_SetupDefaults() Handles tabGeneral.SetupDefaults
    MethodCalled("SetupDefaults: tabGeneral", False)
    If tabGeneral.IsPostBack = False Then
      MethodCalled("BindTab: tabGeneral", True)
      'bind tab
      Me.txtName.Text = PageData.name
      Me.txtDesc.Text = PageData.description
    End If
  End Sub

  Protected Sub tabAdvanced_SetupDefaults() Handles tabAdvanced.SetupDefaults
    MethodCalled("SetupDefaults: tabAdvanced", True)

    'always need to populate items since viewstate disabled
    RefreshColors()
    Me.ddlLocation.DataBind()

    If tabAdvanced.IsPostBack Then  'if tab was rendered, we may need to re-select the listitems that were posted
      'since we are not using the viewstate hack we need to reselect the listitem
      FormUtil.SelectItem(Me.ddlColor, Request.Form(Me.ddlColor.UniqueID))
      FormUtil.SelectItem(Me.ddlLocation, Request.Form(Me.ddlLocation.UniqueID))
    Else
      MethodCalled("BindTab: tabAdvanced", True)
      'bind tab
      Me.txtFont.Text = PageData.font
      FormUtil.SelectItem(Me.ddlColor, PageData.color)
      FormUtil.SelectItem(Me.ddlLocation, PageData.location)
    End If
  End Sub

  Protected Sub btnNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNew.Click
    NewForm()
  End Sub

  Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
    SaveForm()
  End Sub

#End Region

Anyone knows an easy way to convert the code?
 
New Post
3/14/2007 1:17 AM
 
Use reflector on the compiled code.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0DNNTabStripsDNNTabStrips


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out