Dynamic controls and their handlers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Meganutter
    New Member
    • Mar 2009
    • 47

    Dynamic controls and their handlers

    Hello all,

    im making a dynamic .NET page which reads downloads from a XML file.
    there are two controls that have handlers, a category switcher and a download streamer (so people cant surf directly to the file).
    these controls are built out of multiple LinkButtons all having the same event but different ID's

    the controls are linkbuttons, not sure if that gives any troubles.

    when i open the page i have to include a showItems(categ ory); otherwise the handlers of the download streamer dont trigger (not created?).

    i tried creating a dummybutton or a ghost button but nothing worked unless i showed a category on the first page.

    any idea to get their fixed handler attached to the buttons?
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    This is very confusing....

    But,in the PageLoad event, have you tried just specifying a default "category" and calling the method that loads the XML if it's the first time the page is loaded?

    Eg:

    Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
    
       If IsPostBack = False  Then
         'Provide default category 
         'Load XML
       End If
    End Sub

    Comment

    • Meganutter
      New Member
      • Mar 2009
      • 47

      #3
      im sorry i meant to say
      if i dont create the category items and their buttons on the first load it will not trigger their event.

      i already set a default and am calling that on page_load, because i need to
      if i dont, the download linkbuttons wont work.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        I don't understand what your problem is.
        Could you please clarify what you are trying to do and what your problem is.
        Are you creating your controls in the Page Init event?

        Have you seen quick overview of how to use dynamic controls in asp.net?

        -Frinny

        Comment

        • Meganutter
          New Member
          • Mar 2009
          • 47

          #5
          very simple, the problem is

          if i do not create both button types (category button + download button) first time the page loads one type wont fire its event.

          i try to do

          dynamically generate a categories list
          on click
          dynamically generate downloads list

          since im using a streamer to keep the files safe from direct browsing a normal link wont work

          i looked into things like that, but im unable to link the page init event in VWD2008 using C# thus i am using the page_load event

          *edit*
          forgot to mention its an ascx page in DotNetNuke

          Comment

          Working...