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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN CommandButton Control does not implement IButtonControlDNN CommandButton Control does not implement IButtonControl
Previous
 
Next
New Post
7/18/2007 6:37 PM
 

There is a problem using the dnn:CommandButton control within AJAX Update panels and also as the default button for an <asp:panel>.  The dnn:CommandButton control is simply a composite control encapsulating an Imagebutton and LinkButton control, however, the composite control does not implement the IButtonControl interface. 

This prevents AJAX from hooking the click event for either of the embedded controls and causes a full post back rather than an AJAX callback.  I was able to solve this by adding Implements IButtonControl to the class definition and then adding/modifiying code to satisafy the interface and it works fine.  I'd like to suggest a core team member look into this since AJAX has recently been integrated into DNN.

However, there is an additional problem which I can't figure out how to solve.  You can't place the dnn:CommandButton control inside an asp:panel control and use it as the default button (to capture the Enter key press, for example). 

<asp:panel runat="server" id="myPanel" defaultButton="myButton">

<dnn:CommandButton runat="server" id="myButton"/>

</asp:panel>

The problem here is how the dnn:CommandButton control is rendered...   The asp:panel is looking for control called "myButton" which implement the IButtonControl interface.  However, the dnn:CommandButton renders the two actual buttons as child controls of the composite control "myButton".   So, the rendered code is something like "_myPanel_myButton_ImageButton1" and "_myPanel_myButton_LinkButton1".  I'm not sure how to solve this problem.  Perhaps overriding the Render() method?

So...two problems:

1) AJAX isn't hooking the click event to trigger callback instead of postbacks

2) asp:panel controls won't recognize it as a DefaultButton option.

 
New Post
7/23/2007 9:50 PM
 

'

' DotNetNuke® - http://www.dotnetnuke.com

' Copyright (c) 2002-2007

' by DotNetNuke Corporation

'

' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated

' documentation files (the "Software"), to deal in the Software without restriction, including without limitation

' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and

' to permit persons to whom the Software is furnished to do so, subject to the following conditions:

'

' The above copyright notice and this permission notice shall be included in all copies or substantial portions

' of the Software.

'

' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED

' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF

' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

' DEALINGS IN THE SOFTWARE.

'

Imports

System

Imports

System.Drawing

Imports

System.Reflection

Imports

System.Web.UI

Imports

System.Web.UI.WebControls

Imports

System.IO

Imports

DotNetNuke.Common.Globals

Imports

DotNetNuke.Common.Utilities

Imports

DotNetNuke.Services.Localization

Namespace

 

DotNetNuke.UI.WebControls''' -----------------------------------------------------------------------------

 

''' Namespace: DotNetNuke.UI.WebControls

 

''' Project: DotNetNuke

 

''' Class: CommandButton

 

''' -----------------------------------------------------------------------------

 

''' <summary>

 

''' The CommandButton Class provides an enhanced Button control for DotNetNuke

 

''' </summary>

 

''' <remarks>

 

''' </remarks>

 

''' <history>

 

''' [cnurse] 01/06/2006 Created

 

''' [mathisjay] 07/23/2007 Rewritten to implement IButtonControl interface

 

''' </history>

 

''' -----------------------------------------------------------------------------

<ToolboxData(

 

 

 

#

"<{0}:CommandButton runat=server></{0}:CommandButton>")> _Public Class CommandButtonInherits CompositeControlImplements IButtonControlRegion "Controls"

 

 

 

 

#

Private link As New LinkButtonPrivate iconLink As New LinkButtonPrivate icon As New System.Web.UI.WebControls.ImagePrivate spacer As New LiteralControl("&nbsp;")End Region

#

Region "Private Members"

 

Private _onClick As String

 

Private _resourceKey As String

#

End Region

#

Region "Interface Methods"

 

 

Public Property CommandName() As String Implements IButtonControl.CommandNameGet

 

 

 

Me.EnsureChildControls()Return link.CommandNameEnd Get

 

 

iconLink.CommandName = Value

link.CommandName = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

 

 

Public Property Text() As String Implements IButtonControl.TextGet

 

 

 

Me.EnsureChildControls()Return link.TextEnd Get

 

 

iconLink.ToolTip = Value

link.Text = Value

link.ToolTip = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

 

 

Public Property CommandArgument() As String Implements IButtonControl.CommandArgumentGet

 

 

 

Me.EnsureChildControls()Return link.CommandArgumentEnd Get

 

 

iconLink.CommandArgument = Value

link.CommandArgument = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

 

 

Public Property PostBackUrl() As String Implements IButtonControl.PostBackUrlGet

 

 

 

Me.EnsureChildControls()Return link.PostBackUrlEnd Get

 

 

iconLink.PostBackUrl = Value

link.PostBackUrl = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

 

 

Public Property CausesValidation() As Boolean Implements IButtonControl.CausesValidationGet

 

 

 

Me.EnsureChildControls()Return link.CausesValidationEnd Get

 

 

iconLink.CausesValidation = Value

link.CausesValidation = Value

 

Set(ByVal Value As Boolean)Me.EnsureChildControls()End Set

 

End Property

 

 

Public Property ValidationGroup() As String Implements IButtonControl.ValidationGroupGet

 

 

 

Me.EnsureChildControls()Return link.ValidationGroupEnd Get

 

 

iconLink.ValidationGroup = Value

link.ValidationGroup = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

#

End Region

#

Region "Interface Events"

 

 

 

 

 

Public Custom Event Click As EventHandler Implements IButtonControl.ClickAddHandler(ByVal value As EventHandler)AddHandler link.Click, valueAddHandler iconLink.Click, valueEnd AddHandler

 

 

 

 

RemoveHandler(ByVal value As EventHandler)RemoveHandler link.Click, valueRemoveHandler iconLink.Click, valueEnd RemoveHandler

 

 

RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)End RaiseEvent

 

End Event

 

#

Private Event Command As CommandEventHandler Implements IButtonControl.CommandEnd Region

#

Region "Public Properties"

 

Public ReadOnly Property ButtonUniqueID() As String

 

Get

 

If DisplayLink Then

 

 

Return link.UniqueIDElse

 

If DisplayIcon Then

 

 

Return iconLink.UniqueIDElse

 

 

Return Null.NullStringEnd If

 

End If

 

End Get

 

End Property

 

Public Property DisplayLink() As Boolean

 

Get

 

 

 

Me.EnsureChildControls()Return link.VisibleEnd Get

 

 

link.Visible = Value

 

Set(ByVal Value As Boolean)Me.EnsureChildControls()End Set

 

End Property

 

Public Property DisplayIcon() As Boolean

 

Get

 

 

 

Me.EnsureChildControls()Return iconLink.VisibleEnd Get

 

 

iconLink.Visible = Value

spacer.Visible = Value

 

Set(ByVal Value As Boolean)Me.EnsureChildControls()End Set

 

End Property

 

Public Property ImageUrl() As String

 

Get

 

 

 

Me.EnsureChildControls()Return icon.ImageUrlEnd Get

 

 

icon.ImageUrl = Value

 

Set(ByVal Value As String)Me.EnsureChildControls()End Set

 

End Property

 

Public Property OnClick() As String

 

Get

 

 

 

Me.EnsureChildControls()Return link.Attributes.Item("onclick")End Get

 

 

 

Set(ByVal Value As String)Me.EnsureChildControls()If Value = "" Then

iconLink.Attributes.Remove(

link.Attributes.Remove(

 

"onclick")"onclick")Else

iconLink.Attributes.Add(

link.Attributes.Add(

 

"onclick", Value)"onclick", Value)End If

 

End Set

 

End Property

 

Public Property ResourceKey() As String

 

Get

 

 

 

Me.EnsureChildControls()Return link.Attributes.Item("resourcekey")End Get

 

 

 

Set(ByVal Value As String)Me.EnsureChildControls()If Value = "" Then

icon.Attributes.Remove(

link.Attributes.Remove(

 

"resourcekey")"resourcekey")Else

icon.Attributes.Add(

link.Attributes.Add(

 

"resourcekey", Value)"resourcekey", Value)End If

 

End Set

 

End Property

#

End Region

#

Region "Protected Methods"

 

 

Protected Overrides Sub CreateChildControls()'Add IconLink

 

iconLink.Controls.Add(icon)

 

 

Me.Controls.Add(iconLink)Me.Controls.Add(spacer)'Add LinkButton

 

 

Me.Controls.Add(link)If DisplayIcon = True And ImageUrl <> "" Then

iconLink.EnableViewState =

icon.EnableViewState =

 

Me.EnableViewStateMe.EnableViewStateEnd If

 

If DisplayLink Then

 

If CssClass = "" Then CssClass = "CommandButton"

link.CssClass = CssClass

link.EnableViewState =

 

Me.EnableViewStateEnd If

 

End Sub

#

End Region

 

End

End Class Namespace

 
New Post
5/11/2010 5:00 AM
 
Did anyone ever pick this up?
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...DNN CommandButton Control does not implement IButtonControlDNN CommandButton Control does not implement IButtonControl


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