How to prevent changes to CheckBoxList

Discussion in 'ASP .Net' started by Meerkat, Jul 2, 2003.

  1. Meerkat

    Meerkat Guest

    Hello.
    Can anyone tell me if there is ANY way to prevent the user changing
    the values in a checkboxlist. I just want to use it for information
    only. Disabling it is not an option as it results in a unacceptable
    gray color.

    Many thanks in advance for any replies.
    Meerkat, Jul 2, 2003
    #1
    1. Advertising

  2. Meerkat

    Duncan Welch Guest

    Use a bit of javascript in the onChanged property, and set it back to it's
    checked property every time.

    D

    <Meerkat> wrote in message
    news:...
    > Hello.
    > Can anyone tell me if there is ANY way to prevent the user changing
    > the values in a checkboxlist. I just want to use it for information
    > only. Disabling it is not an option as it results in a unacceptable
    > gray color.
    >
    > Many thanks in advance for any replies.
    Duncan Welch, Jul 2, 2003
    #2
    1. Advertising

  3. Meerkat

    Meerkat Guest

    Hello Rajesh,

    Your suggestion looks to be just the sort of thing I am looking for.
    ( i.e. simple) However, could I impose on your kindness a little
    more and ask exactly where do I put the code that you suggest.
    Is it in the code behind or the html? and what is the exact syntax.
    I have tried all sorts of things but failed miserably.

    Many thanks in anticipation,

    Meerkat.


    On Wed, 02 Jul 2003 04:58:17 -0700, Rajesh Tiwari <>
    wrote:

    >use onfocus="this.blur()"
    >
    >try something like
    >ChkBoxId.Attributes("onfocus")="javascript:this.blur()"
    >
    >hope it helps
    >
    >Rajesh
    >
    >*** Sent via Developersdex http://www.developersdex.com ***
    >Don't just participate in USENET...get rewarded for it!
    Meerkat, Jul 2, 2003
    #3
  4. hi meerkat,
    sorry for the late reply.here is the code that u were looking for.

    run this code and see if it is of some help

    <%@ Page Language="c#" debug=true%>
    <%@ Import Namespace="System.Data" %>
    <Script Language="C#" runat=server>
    void Page_Load(Object sender,EventArgs e)
    {

    lst2.Attributes["onclick"]="javascript:return false";
    }
    </script>
    <html>
    <body>
    <form id=frm1 runat=server>
    <asp:CheckBoxList id=lst2 runat=server>
    <asp:ListItem>a</asp:Listitem>
    </asp:CheckBoxList>
    </form>
    </body>
    </html>

    i hope i answered ur query.

    Rajesh

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Rajesh Tiwari, Jul 5, 2003
    #4
  5. Meerkat

    David Waz... Guest

    how about setting ENABLED property to false
    or VISIBLE property to false


    "Rajesh Tiwari" <> wrote in message
    news:...
    > hi meerkat,
    > sorry for the late reply.here is the code that u were looking for.
    >
    > run this code and see if it is of some help
    >
    > <%@ Page Language="c#" debug=true%>
    > <%@ Import Namespace="System.Data" %>
    > <Script Language="C#" runat=server>
    > void Page_Load(Object sender,EventArgs e)
    > {
    >
    > lst2.Attributes["onclick"]="javascript:return false";
    > }
    > </script>
    > <html>
    > <body>
    > <form id=frm1 runat=server>
    > <asp:CheckBoxList id=lst2 runat=server>
    > <asp:ListItem>a</asp:Listitem>
    > </asp:CheckBoxList>
    > </form>
    > </body>
    > </html>
    >
    > i hope i answered ur query.
    >
    > Rajesh
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    David Waz..., Jul 6, 2003
    #5
    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. Francois Verbeeck
    Replies:
    0
    Views:
    1,884
    Francois Verbeeck
    Jun 24, 2003
  2. JD
    Replies:
    5
    Views:
    11,644
    NetArchitect
    Aug 8, 2007
  3. MattB
    Replies:
    2
    Views:
    5,190
    MattB
    Nov 12, 2004
  4. Patrick.O.Ige
    Replies:
    5
    Views:
    19,103
    Patrick.O.Ige
    Jun 19, 2005
  5. Wongod
    Replies:
    2
    Views:
    707
Loading...

Share This Page