click event is not firing in ascx file within web form

Discussion in 'ASP .Net' started by sanju, Jun 17, 2004.

  1. sanju

    sanju Guest

    hi there i am trying to fire an button event in ascx file which interacts
    with database ,my problem is " i am calling ascx file wiht a button click
    dynamically when user needs to update database in aspx page , but the the
    update button in ascx is not firing .. ..

    but it is working fine when i call ascx like this manually.

    '<callcontrol:callcontrol id=callcontrol runat="server"/>

    <%@ Register TagPrefix="callcontrol" TagName="callcontrol"
    src="callcontrol.ascx" %>

    sub logacall(s As Object, e As EventArgs)
    dim callcontrol1 as Control
    callcontrol1= new callcontrol
    LoadControl("callcontroll.ascx")
    placeholder1.Controls.Add(callcontrol1)
    end sub




    plz help me in this regard i am trying since days to sort this.. i want to
    load ascx file when a user needs.

    sanju
     
    sanju, Jun 17, 2004
    #1
    1. Advertising

  2. sanju,

    When you add a control to a page dynamically, it needs to be added again on
    postback in order for that control's events to fire on postback.

    I have some sample code for dynamically adding controls that may be helpful
    for you to look at. In the code library of my site, www.aboutfortunate.com,
    use the search box and search for: dynamic controls. You'll get a few useful
    samples.

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer

    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzsche
    "sanju" <> wrote in message
    news:...
    > hi there i am trying to fire an button event in ascx file which interacts
    > with database ,my problem is " i am calling ascx file wiht a button click
    > dynamically when user needs to update database in aspx page , but the the
    > update button in ascx is not firing .. ..
    >
    > but it is working fine when i call ascx like this manually.
    >
    > '<callcontrol:callcontrol id=callcontrol runat="server"/>
    >
    > <%@ Register TagPrefix="callcontrol" TagName="callcontrol"
    > src="callcontrol.ascx" %>
    >
    > sub logacall(s As Object, e As EventArgs)
    > dim callcontrol1 as Control
    > callcontrol1= new callcontrol
    > LoadControl("callcontroll.ascx")
    > placeholder1.Controls.Add(callcontrol1)
    > end sub
    >
    >
    >
    >
    > plz help me in this regard i am trying since days to sort this.. i want to
    > load ascx file when a user needs.
    >
    > sanju
    >
    >
     
    S. Justin Gengo, Jun 17, 2004
    #2
    1. Advertising

  3. sanju

    sanju reddy Guest

    thank u very much justin.. i got it event firing in ascx ..now its
    working fine.. thank u very much,and the site is really helpful.

    cheers
    sanju

    *** Sent via Devdex http://www.devdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    sanju reddy, Jun 17, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ~~~ .NET Ed ~~~
    Replies:
    3
    Views:
    15,126
    nizarbabu
    Sep 8, 2008
  2. Chu
    Replies:
    2
    Views:
    913
    Winista
    Apr 10, 2006
  3. cindy
    Replies:
    0
    Views:
    422
    cindy
    Sep 9, 2008
  4. Replies:
    1
    Views:
    1,717
    Evan Freeman
    Sep 12, 2008
  5. Replies:
    2
    Views:
    548
Loading...

Share This Page