creating plugin interface

Posted on 2010-01-05
Medium Priority
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

Todd Gerbert earned 2000 total points
ID: 26190092
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


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Loops Section Overview
Suggested Courses

864 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