CheckListBox MouseOver

Discussion in 'ASP .Net' started by =?Utf-8?B?VmlkZHM=?=, Jan 12, 2006.

  1. Hi ALL,

    Can any one give me a solution to handle mouse over event of each of the
    Check Box Control in a CheckListBox Control.

    Thanks in advance

    Regards
    Vidds
     
    =?Utf-8?B?VmlkZHM=?=, Jan 12, 2006
    #1
    1. Advertising

  2. The items that you would need to modify in the CheckBoxList are private,
    so they can't be manipulated. If this is a absolute must-have, you can
    resort to modifying the rendered output of the control to do what you
    want.

    Add this class:
    Public Class ChkboxListWithMouseOver
    Inherits CheckBoxList

    Protected Overrides Sub Render(ByVal writer As
    System.Web.UI.HtmlTextWriter)
    Dim html As String
    Dim sw As New IO.StringWriter
    Dim capture As New HtmlTextWriter(sw)

    MyBase.Render(capture)

    html = sw.GetStringBuilder.ToString
    html = html.Replace("type=""checkbox""", _
    "type=""checkbox"" onmouseover=""alert('you moused
    over.');""")

    writer.WriteLine(html)

    End Sub
    End Class

    Create a page with the control:
    <%@ Page Language="vb" AutoEventWireup="false"
    Codebehind="TestPage.aspx.vb" Inherits="**YOURPROJECT**.TestPage"%>
    <%@register tagprefix="cb" assembly="**YOURPROJECT**"
    namespace="**YOURPROJECT**" %> <html>
    <body>
    <form id="Form1" method="post" runat="server">
    <cb:ChkboxListWithMouseOver Runat=server ID="chkList" />
    </form>
    </body>
    </html>

    (**YOURPROJECT** is the name of your project. You must replace this
    value. If you are using namespaces, edit accordingly.)

    Hope this helps.

    --
    ----
    700cb Development, Inc.
    http://www.700cb.net
    ..NET utilities, developer tools,
    and enterprise solutions


    "=?Utf-8?B?VmlkZHM=?=" <> wrote in
    news::

    > Hi ALL,
    >
    > Can any one give me a solution to handle mouse over event of each of
    > the Check Box Control in a CheckListBox Control.
    >
    > Thanks in advance
    >
    > Regards
    > Vidds
    >
     
    cbDevelopment, Mar 13, 2006
    #2
    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. D. Shane Fowlkes
    Replies:
    0
    Views:
    571
    D. Shane Fowlkes
    Apr 7, 2004
  2. brian

    CheckListBox

    brian, Apr 27, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    542
    brian
    Apr 27, 2004
  3. Mau

    Problem with CheckListBox

    Mau, Sep 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,439
    Martin Dechev
    Sep 27, 2004
  4. Vikram

    Height of checklistbox

    Vikram, Mar 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    2,882
    Steve C. Orr [MVP, MCSD]
    Mar 1, 2005
  5. Replies:
    1
    Views:
    1,248
    Ed Leafe
    Jan 13, 2005
Loading...

Share This Page