[CLOSED] [1.0] DirectEvents in Usercontrols

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] [1.0] DirectEvents in Usercontrols

    Question for the experts, I need to call a direct-method for a loaded user control thats on the user-control code-behind. When I click the button on the user-control that's loaded it gives me an error saying it can't find the button.

    Example (I kind of need this answered in a hurry, I appreciate it, thanks!)

    This loads the window
        Public Sub btnForgotPassword_Click(ByVal sender As Object, ByVal e As DirectEventArgs)
            Dim window As New Ext.Net.Window()
            window.Closable = "true"
            window.Icon = Icon.Help
            window.Width = "378"
            window.AutoHeight = True
            window.Resizable = False
            window.Draggable = False
            window.ID = "wForgotPassword"
            window.Title = "Recover Forgotten Oracle Password"
            window.Modal = "true"
            window.Center()
    
    
            ' here you have to load required user control
            window.ContentControls.Add(LoadControl("Usercontrols/wForgotPassword/wForgotPassword.ascx"))
    
    
            form1.Controls.Add(window)
            window.Render()
        End Sub
    The standard button on the usercontrol is just calling a directevent in codebehind.

    Public Sub Recover(ByVal sender As Object, ByVal e As DirectEventArgs)
        Dim RecoverPass As String = ResetPassword(tForgotUsername.Text, cPassword.SelectedItem.Text)
    End Sub
    I think it's something where it's just not registering the controls to the ResourceManager?

    RecoverPassword is the name of the button on the UserControl Page.

    The control with ID 'ctl20_RecoverPassword' not found
    Last edited by geoffrey.mcgill; Jul 15, 2010 at 6:35 AM. Reason: formatting
  2. #2

    RE: [CLOSED] [1.0] DirectEvents in Usercontrols

    Hi,

    Any dynamic control must be recreated on each request (for correct events handling or viewstate loading). It is related with ASP.NET stateless (the page is recreated for each request (new instance is created) and page doesn't remember previous state )


    In your case you have to recreate window and reload user control (just doesn't call Render when you recreate)
  3. #3

    RE: [CLOSED] [1.0] DirectEvents in Usercontrols

    Yeah just searched it and found that out, what a pain.... I don't suppose we have any ideas on how we can have it registered with the ResourceManager at the time its loaded, so we don't need to recreate it?

    Thanks mark as solved.
  4. #4

    RE: [CLOSED] [1.0] DirectEvents in Usercontrols

    hi.. have the same problem :( do you have found a solutions ?
  5. #5

    RE: [CLOSED] [1.0] DirectEvents in Usercontrols

    We never found a solution, we ended up getting away from user controls because I didn't like having to recreate them every time we ran a command on the page.

    We wanted the ability to create auto generated forms from the system, but it turned out to be harder then it looked.


    What we ended up doing was creating new pages, and loading them as IFrames in the autoload of panels. The forms also got simpler so it was easier to program. We ended up creating gridpanels with the questions and made the gridpanels editable so we used them for data entry.


    If you have any specific questions you can email me.


    Good Luck!


  6. #6

    RE: [CLOSED] [1.0] DirectEvents in Usercontrols

    tank's.. but mybe i found a solution for this problem.. if you want i send you my solution
  7. #7
    Quote Originally Posted by maxdiable View Post
    tank's.. but mybe i found a solution for this problem.. if you want i send you my solution
    Might you, please post your solution?

Similar Threads

  1. [CLOSED] Need Help with DirectMethod and UserControls
    By naatye in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 31, 2012, 5:22 PM
  2. [CLOSED] Loader with UserControls
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 13
    Last Post: Jun 29, 2012, 12:08 PM
  3. [CLOSED] Portlets and UserControls
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 14, 2010, 7:32 PM
  4. [CLOSED] UserControls and Events
    By drgw74 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 05, 2010, 5:07 PM
  5. [CLOSED] UserControls within FormPanel
    By drgw74 in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 30, 2010, 1:45 PM

Posting Permissions