CodeSmith Community
Your Code. Your Way. Faster!

Events from User control

Latest post 12-19-2006 2:19 AM by swin. 1 replies.
  • 12-17-2006 10:29 AM

    • itai_mo
    • Not Ranked
    • Joined on 12-17-2006
    • Posts 2
    • Points 70

    Events from User control

    Hi All!

     

    I have a page that contains a generated user control. I add the user control some functionality and I want to catch the events in the page.

    I cant use the delegate as useall since the web control is showen as data:TemplatePath.

    Can someone help me please?

     

     

    Thank's

    Itai

    • Post Points: 35
  • 12-19-2006 2:19 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 924
    • Points 34,750

    Re: Events from User control

    In your main code behind page do the following:

    1. Find your control using the FormUtil.FindControl method i.e. Control mycontrol = FormUtil.FindControl(FormView1, "mycontrol");

    2. Add an event handler programatically using mycontrol.someevent += and VS will generate the method for you.

    HTH

    swin

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 5
Page 1 of 1 (2 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems