我有这个简单的代码,我想要的是检查客户是否是商业客户类型。如果没有,将出现错误。如果是,它将被定向到另一页。我在这里错过了什么吗?
protected void Button1_Click(object sender, EventArgs e)
{
if ("Customer Type" != "Commercial Customer")
{
lblerror.Text = "For commercial customers only";
}
else
{
Response.Redirect("CreditRequestRegistration.aspx");
}
}
这是我的aspx代码:
<ItemTemplate>
<table id="tblcustomerprofile" border="1" cellpadding="1" cellspacing="0">
<tr>
<%--<td style="width:100px">
ID:
</td>
<td style="width:250px">
<strong><%# Eval("ID")%></strong>
</td>--%>
<tr>
<td class="style1" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Username:
</td>
<td class="style2" style ="border-style:ridge; border-width:thin">
<strong><%# Eval("Username")%></strong>
</td>
<tr>
<td class="style3" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
FirstName:
</td>
<td class="style4" style="border-style:ridge; border-width:thin">
<strong><%# Eval("Firstname")%></strong>
</td>
<tr>
<td class="style20"
style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
LastName:
</td>
<td class="style21" style="border-style:ridge; border-width:thin">
<strong><%# Eval("Lastname")%></strong>
</td>
<tr>
<td class="style9" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Email Address:
</td>
<td class="style10" style="border-style:ridge; border-width:thin">
<strong><%# Eval("Email")%></strong>
</td>
<tr>
<td class="style11" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Password:
</td>
<td class="style12" style="border-style:ridge; border-width:thin">
<strong><%# Eval("Password")%></strong>
</td>
</tr>
<tr>
<td class="style13" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Customer Type:
</td>
<td class="style14" style="border-style:ridge; border-width:thin">
<strong><%# Eval("CustomerType")%></strong>
</td>
</tr>
<tr>
<td class="style15" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Delivery Address:
</td>
<td class="style19" style="border-style:ridge; border-width:thin">
<strong><%# Eval("DeliveryAddress") %></strong>
</td>
<tr>
<td class="style15" style="border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Zip Code:
</td>
<td class="style19" style="border-style:ridge; border-width:thin">
<strong><%# Eval("Zip")%></strong>
</td>
</tr>
<tr>
<td class="style17" style=" border-style:ridge; border-width:thick; border-color:White; background-color:#FF3300; font-size:small; color:White">
Contact Number:
</td>
<td class="style18" style="border-style:ridge; border-width:thin">
<strong><%# Eval("ContactNumber")%></strong>
</td>
</tr>
</table>
<asp:LinkButton ID="EditButton" ForeColor="Blue"
Text="Update Profile"
CommandName="Edit"
RunAt="server"/>
</ItemTemplate>