web user control events

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg

    #1

    web user control events

    I have an ascx web user control that has a button and listbox. I want to be able to expose the click event of the button and return the selected value in the listbox to the aspx page that uses the control. Or, I could capture the click event by the aspx page and expose the selected item property of the listbox. I am having problems just capturing the event on the aspx page and I think it's because the control is being loaded dynamically (I think the control is being lost on postback and the control is reloaded only after the click event tried to fire???). Also, I'm not sure if it makes a difference, but the aspx page might be loading 0 to unlimited number of these controls, one after another. Can anyone help or at least point me in the right direction? I'm pretty new at building web user controls, so it's entirely possible that I'm not even exposing the click event to the aspx page correctly in teh first place. I can put some of my code up if it'll help.
  • Cor Ligthert

    #2
    Re: web user control events

    Greg,

    It seems that I am today only giving advices for better newsgroups, however
    better newsgroups for your question can be.

    microsoft.publi c.dotnet.framew ork.aspnet
    microsoft.publi c.dotnet.langua ges.csharp
    microsoft.publi c.dotnet.langua ges.vbnet

    You can crosspost (more messages in one time to more dotnet newsgroups),
    however there should be a rare reason to send it crossposted to Csharp and
    vbnet.

    However in my opinion you have to show how you set the eventhandler

    By instance in this sample I have set all the buttoncontrols in an array and
    add that to one event.

    AddHandler mybutton(i).Cli ck, AddressOf mybutton_Click

    I hope this helps?

    Cor


    Comment

    Working...