Custom Validator

Discussion in 'ASP .Net' started by Joey, May 23, 2007.

  1. Joey

    Joey Guest

    asp.net 2/C#/VS2005

    I want to create a validator that will be able to check a drop-down
    list box to make sure that the first item (index 0) is NOT selected.

    Does anyone have any ideas about how to do this?
     
    Joey, May 23, 2007
    #1
    1. Advertising

  2. Hi Joey,

    <asp:DropDownList runat="server" ID="choices">
    <asp:ListItem Text="Please select..." Value="" />
    <asp:ListItem Text="Choice 1" Value="1" />
    <asp:ListItem Text="Choice 2" Value="2" />
    <asp:ListItem Text="Choice 3" Value="3" />
    </asp:DropDownList>
    <asp:RequiredFieldValidator runat="server"
    ID="choicesValidator"
    ControlToValidate="choices"
    Text="*"
    Display="Dynamic"
    EnableClientScript="true"
    InitialValue="" />
    <asp:Button runat="server" ID="submit" Text="Submit" />

    Hope this helps
    --
    Milosz


    "Joey" wrote:

    > asp.net 2/C#/VS2005
    >
    > I want to create a validator that will be able to check a drop-down
    > list box to make sure that the first item (index 0) is NOT selected.
    >
    > Does anyone have any ideas about how to do this?
    >
    >
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, May 23, 2007
    #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. Serdar Kalaycý

    Custom Validator

    Serdar Kalaycý, Jul 7, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    544
    Serdar Kalaycý
    Jul 8, 2003
  2. Mike P

    custom validator

    Mike P, Nov 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    365
    Mike P
    Nov 5, 2003
  3. Arvind P Rangan

    Custom Validator Issue

    Arvind P Rangan, Nov 12, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    368
  4. Replies:
    4
    Views:
    947
    Richter~9.6
    Feb 13, 2007
  5. Scott Yenor

    How to get custom control to work with custom validator

    Scott Yenor, Jan 27, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    236
    Scott Yenor
    Jan 27, 2004
Loading...

Share This Page