What I need to do is customer validator. The code that I have in the code behind needs to look at both the credit card type as well as the credit card number. I am not sure how to do this.
<asp:DropDownList ID="ddlCCType" runat="server">
<asp:ListItem Value="None">Select Card Type</asp:ListItem>
<asp:ListItem Value="Visa">Visa</asp:ListItem>
<asp:ListItem Value="Amex">Amex</asp:ListItem>
<asp:ListItem Value="Mastercard">Mastercard</asp:ListItem>
</asp:DropDownList>
<asp:TextBox ID="txtCardNum" runat="server" Width="200px"></asp:TextBox>
<asp:CustomValidator runat="server" id="cusCustom" controltovalidate="txtCardNum" onservervalidate="txtCard_ServerValidate" errormessage="The credit card is incorrect." />
I have the code below but not sure how to retrieve the value of the credit card type. e.Value will only return the value of the credit card number.
protected void txtCard_ServerValidate(object sender, ServerValidateEventArgs e)
{
if(e.Value.Length == 8)
......
e.IsValid = true;
else
e.IsValid = false;
}