creating plugin interface

Posted on 2010-01-05
Last Modified: 2012-05-08
Hi all,

I have a custom control i have created (basically for displaying data in a dataview.)

Now i want to catch an event when a cell is left (so i can error check the cell contents.)

however this would be different (potentially) for each page the control is used on.

would it be possible (and if so how would i do it please) to create a plugin interface for this control and then override (when needed) this event?

thanks in advance.

Question by:flynny
    1 Comment
    LVL 33

    Accepted Solution

    In your custom control, you would handle one of the GridView's events, like RowUpdating.  Add your own event to the custom control, like MyRowUpdating; then in the event handler for the GridView's RowUpdating event you would raise your control's MyRowUpdating event.

    When the user control is used in a page, that web page can add a handler for your control's MyRowUpdating event.

    <script runat="server">
        protected void WebUserControl11_MyRowUpdating(object sender, GridViewUpdateEventArgs e)
            label1.Text = String.Format("Row updated: {0}", e.RowIndex);

    <uc1:WebUserControl1 ID="WebUserControl11" runat="server" OnMyRowUpdating="WebUserControl11_MyRowUpdating" />
    public partial class WebUserControl1 : System.Web.UI.UserControl
        public event GridViewUpdateEventHandler MyRowUpdating;
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        protected virtual void OnRowUpdating(GridViewUpdateEventArgs e)
            if (MyRowUpdating != null)
                MyRowUpdating(this, e);

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Suggested Solutions

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now