私がする必要があるのは顧客バリデーターです。私がコードビハインドに持っているコードは、クレジットカードの種類とクレジットカード番号の両方を調べる必要があります。これを行う方法がわかりません。
<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." />
以下のコードがありますが、クレジットカードタイプの値を取得する方法がわかりません。e.Valueは、クレジットカード番号の値のみを返します。
protected void txtCard_ServerValidate(object sender, ServerValidateEventArgs e)
{
if(e.Value.Length == 8)
......
e.IsValid = true;
else
e.IsValid = false;
}