Professional Web Applications Themes

Implementing IPostBackDataHandler in a custom web control with VB.NET - ASP.NET Building Controls

I have created a custom class with Visual Basic that inherits from the drop down list web control. In order to update the value properly, I have tried to implement IPostBackDataHandler, but receive the following error message: Interface 'System.Web.UI.IPostBackDataHandler' is already implemented by base class 'System.Web.UI.WebControls.DropDownList'. My code is as follows: Imports System.Web.UI Public Class CodeDescDropDown Inherits System.Web.UI.WebControls.DropDownList Implements INamingContainer Implements IPostBackDataHandler Protected Overrides Sub Render(ByVal output as System.Web.UI.HtmlTextWriter) Mybase.Render(output) End Sub 'Class implementation End Class For some reason, this error is not created if I use C# to write the class, but I really want to use VB. Please ...

  1. #1

    Default Implementing IPostBackDataHandler in a custom web control with VB.NET

    I have created a custom class with Visual Basic that inherits from the
    drop down list web control. In order to update the value properly, I
    have tried to implement IPostBackDataHandler, but receive the
    following error message:

    Interface 'System.Web.UI.IPostBackDataHandler' is already implemented
    by base class 'System.Web.UI.WebControls.DropDownList'.

    My code is as follows:

    Imports System.Web.UI

    Public Class CodeDescDropDown
    Inherits System.Web.UI.WebControls.DropDownList
    Implements INamingContainer
    Implements IPostBackDataHandler

    Protected Overrides Sub Render(ByVal output as
    System.Web.UI.HtmlTextWriter)
    Mybase.Render(output)
    End Sub

    'Class implementation

    End Class

    For some reason, this error is not created if I use C# to write the
    class, but I really want to use VB. Please let me know if you need
    more information. Thanks for the help.
    Andrew Dawson Guest

  2. #2

    Default Re: Implementing IPostBackDataHandler in a custom web control with VB.NET

    Hi,

    this is a lack of feature in VB.NET. It doesn't allow you to reimplement an
    interface on derived class, but C# does.

    See here:
    [url]http://weblogs.asp.net/fbouma/archive/2003/11/12/37199.aspx[/url]

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    [url]http://blogs.aspadvice.com/joteke[/url]

    "Andrew Dawson" <adawsonufcw.org> wrote in message
    news:4fc58d42.0408091241.6ed1f838posting.google.c om...
    > I have created a custom class with Visual Basic that inherits from the
    > drop down list web control. In order to update the value properly, I
    > have tried to implement IPostBackDataHandler, but receive the
    > following error message:
    >
    > Interface 'System.Web.UI.IPostBackDataHandler' is already implemented
    > by base class 'System.Web.UI.WebControls.DropDownList'.
    >
    > My code is as follows:
    >
    > Imports System.Web.UI
    >
    > Public Class CodeDescDropDown
    > Inherits System.Web.UI.WebControls.DropDownList
    > Implements INamingContainer
    > Implements IPostBackDataHandler
    >
    > Protected Overrides Sub Render(ByVal output as
    > System.Web.UI.HtmlTextWriter)
    > Mybase.Render(output)
    > End Sub
    >
    > 'Class implementation
    >
    > End Class
    >
    > For some reason, this error is not created if I use C# to write the
    > class, but I really want to use VB. Please let me know if you need
    > more information. Thanks for the help.

    Teemu Keiski Guest

Similar Threads

  1. Replies: 1
    Last Post: May 20th, 10:08 AM
  2. Replies: 2
    Last Post: May 18th, 08:48 AM
  3. Implementing columns collection in Data grid custom control
    By Sundararajan in forum ASP.NET Building Controls
    Replies: 1
    Last Post: March 29th, 01:21 AM
  4. Implementing postback functionality in custom control
    By Showjumper in forum ASP.NET Building Controls
    Replies: 5
    Last Post: March 6th, 05:57 PM
  5. Implementing Control Designer Class for Composite Server Control
    By Sacha Vieux-Roy in forum ASP Components
    Replies: 1
    Last Post: November 10th, 01:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139