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.0Paging Control - customizingPaging Control - customizing
Previous
 
Next
New Post
3/7/2007 12:45 PM
 

This is more of a ASP.NET question than purley DNN but you guys are so helpful!

I am trying to make a new paging control out of the one that DNN uses (I just like it is the only reason) I need to change the links to linkbuttons and I have done that but I cant figure out how to attach a click event to the buttons - has anybody messed with or have more knowledge about creating controls that could give me a bit of help here

TIA

 


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/7/2007 2:42 PM
 

I am assuming you want to be able to trap the click event of the LinkButton and use it to raise an event (PageClicked) in the modified PageControl, so my comments will address this scenario.

1. In your control declare a Delegate for the PageClickedEventHandler

        Public Delegate Sub PageClickedEventHandler(ByVal sender As Object, ByVal e As PageClickedEventArgs)

2. Create a PageClickedEventArgs Class (as the class is only going to be used by this control you can create it inside the control)

        Public Class PageClickedEventArgs Inherits EventArgs

            Public PageNo As Integer

        End Class

3. In your control declare an Event for the PageClicked event (notice it is of the type PageClickedEventHandler declared above)

        Public Event PageClicked As PageClickedEventHandler

4. In your control create a method to raise the event (OnPageClicked)

        Public Sub OnPageClicked(ByVal e As PageClickedEventArgs)

            RaiseEvent PageClicked (Me, e)

        End Sub

You now have the infrastructure to raise a PageClicked event, but you still need to connect it to the LinkButtons command event.  Let us assume you have created a LinkButton called nextPage.  When you create the button you will need to set the CommandArgument to the pageNo for the next page

        nextPage.CommandArgument = nextPageNo.ToString()

Next you will need to create the event handler for the OnCommand event (lets say for now it is called nextButton_Command).

        Private Sub nextButton_Command(ByVal sender As Object, ByVal e As CommandEventArgs)
            Dim pageNo as Integer = Integer.Parse(e.CommandArgument)

            Dim e as PageClickedEventArgs = new PageClickedEventArgs
            e.PageNo = pageNo 

            OnPageClicked(e)

        End Sub

The final step is to bind your LinkButton you created to this Command Event Handler, so in the logic when you create this button (and set its command argument (see above), add the following

        AddHandler nextPage.Command, AddressOf nextButton_Command

This should work - at least it should point you to how to do it.



Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
New Post
3/7/2007 3:34 PM
 

Charles - I sort of follow you and thanks for the info

 

i'll try it out and see what i can come up with

 


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/7/2007 3:34 PM
 

One thing where does the eventargs inherit from in this class

Public Class PageClickedEventArgs Inherits EventArgs

Public PageNo As Integer

End CLass


Dylan Barber http://www.braindice.com - Dotnetnuke development classes - skins and modules
 
New Post
3/7/2007 3:41 PM
 
System.EventArgs is a base .NET class

Charles Nurse
Chief Architect
Evoq Content Team Lead,
DNN Corp.

Want to contribute to the Platform project? - See here
MVP (ASP.NET) and
ASPInsiders Member
View my profile on LinkedIn
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Paging Control - customizingPaging Control - customizing


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