creating custom web control .. any ideas ?

Discussion in 'ASP .Net Web Controls' started by Nikolay Anestev, Feb 22, 2005.

  1. Hi all. In an ASP.NET application I want to make a DataGrid derrived class
    named "MyDataGrid" which will encapsulate some common actions and then use
    it in my pages instead of the DataGrid class.
    When I rename the base class of any existing page member from:

    public class MyPage : Page {

    protected DataGrid DataGrid1;

    ..... }

    , to:

    public class MyPage : Page {

    protected MyDataGrid DataGrid1;

    ..... }

    a run-time error occurs:

    Parser Error Message: The base class includes the field 'DataGrid1', but its
    type (CSWebBankASP.MyDataGrid) is not compatible with the type of control
    (System.Web.UI.WebControls.DataGrid).


    So, I've added a "<%@ Register TagPrefix=uc2 Namespace=MyApp Assembly=MyApp
    %>" directive at the top of the *.asp document and then changed the
    "<asp:DataGrid>" tag to "<uc2:MyDataGrid>". In result this page works fine
    already, but in the design view this DataGrid is not represented properly
    ( an error text occurs ) which tells me that there is something wrong in
    this kind of technique.

    So, does anyone have an idea how to do this without any errors? Just want to
    tell you that using an UserControl doesn't work for me.

    Thank you in advance. Best regards.

    Nikolay Anestev
     
    Nikolay Anestev, Feb 22, 2005
    #1
    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. Ravi Ambros Wallau
    Replies:
    0
    Views:
    4,094
    Ravi Ambros Wallau
    Jun 1, 2005
  2. David Hearn
    Replies:
    4
    Views:
    344
    David Hearn
    May 4, 2006
  3. Matt Sokol
    Replies:
    2
    Views:
    392
    Theo Tillotson
    Aug 7, 2003
  4. Deniz Miscioglu
    Replies:
    1
    Views:
    168
    Deniz Miscioglu
    Oct 19, 2003
  5. Ravi Ambros Wallau
    Replies:
    0
    Views:
    315
    Ravi Ambros Wallau
    Jun 1, 2005
Loading...

Share This Page