List value attribute

Last post 04-21-2009 6:02 AM by sksmum. 2 replies.

Sort Posts:

  • List value attribute

    04-20-2009, 7:27 PM
    • Member
      28 point Member
    • sksmum
    • Member since 04-11-2009, 4:03 PM
    • Posts 18

     We have Range Attribute where we can specify the minimum and maximum value for a column

    is their a attribute or method by which i can specify a list of  valid values like (15,30,45,60)

     

  • Re: List value attribute

    04-20-2009, 9:02 PM
    Answer

    Hi There,

    You can use reqularexpressionvalidator to validate the requirement. and maybe require field validator to ensure text is not empty

    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="This is required!" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Only accept value 15, 30, 45, 60." ControlToValidate="TextBox1" ValidationExpression="(15|30|45|60)"></asp:RegularExpressionValidator>

    Hope it helps!

    DC517
    Don't forget to click "Mark as Answer" on the post that helped you.
    This credits that member, earns you a point and marks your thread as Resolved.
  • Re: List value attribute

    04-21-2009, 6:02 AM
    Answer
    • Member
      28 point Member
    • sksmum
    • Member since 04-11-2009, 4:03 PM
    • Posts 18

     Thanks for the Lead

    [RegularExpression("(0|15|30|45)", ErrorMessage = "Mintues Must be 0 - 15 - 30 - 45")]

     

     

     

Page 1 of 1 (3 items)