First time I am writing some ASP.NET code and stumbled upon a weird bug. When I click the button to post, it does so, but without any params.
Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="SingTelAPI.Login" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<table style="width:100%;">
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<table style="width:100%;">
<tr>
<td>
</td>
<td align="center">
<asp:Label ID="Label4" runat="server" Text="Login" Font-Bold="True"
Font-Names="Verdana" ForeColor="#CC0000" Font-Size="Large"></asp:Label>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Panel runat="server" DefaultButton="SubmitBtn" ID="Panel1">
<table style="width:100%;">
<tr>
<td class="style1">
<asp:Label ID="Label9" runat="server" Font-Bold="True" Font-Names="Verdana"
ForeColor="#0066FF" Text="Inupt Details:"></asp:Label>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="Label5" runat="server" Text="Email:"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="Email" runat="server" Skin="Default">
</telerik:RadTextBox>
</td>
<td>
<asp:CustomValidator ID="EmailValidator" runat="server"
ErrorMessage="Please Enter Email" Font-Bold="True" Font-Names="Verdana"
ForeColor="#00CC66" ControlToValidate="Email" ValidateEmptyText="True"
ValidationGroup="LoginValidation"></asp:CustomValidator>
</td>
</tr>
<tr>
<td class="style1">
<asp:Label ID="Label6" runat="server" Text="Password:"></asp:Label>
</td>
<td>
<telerik:RadTextBox ID="Password" Runat="server" Skin="Default">
</telerik:RadTextBox>
</td>
<td>
<asp:CustomValidator ID="PasswordValidator" runat="server"
ControlToValidate="Password" ErrorMessage="Please Enter Password" Font-Bold="True"
Font-Names="Verdana" ForeColor="#00CC66" ValidateEmptyText="True"
ValidationGroup="LoginValidation"></asp:CustomValidator>
</td>
</tr>
<tr>
<td class="style1" colspan="3">
<hr /></td>
</tr>
<tr>
<td class="style1">
<telerik:RadButton ID="SubmitBtn" runat="server"
Skin="Default" Text="Login" ValidationGroup="LoginValidation"
Width="120px">
</telerik:RadButton>
</td>
<td>
<asp:Label ID="ResultsLabel" runat="server" ForeColor="#339933"></asp:Label>
</td>
<td>
</td>
</tr>
</table>
</asp:Panel>
</td>
<td>
</td>
</tr>
</table>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</asp:Content>
And the .cs file:
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string email = HttpContext.Current.Request["Email"];
Label9.Text = email;
}
}
}
It changes the text of Label9 to "" for some reason. First I thought the problem was in the fact that I didn't have telerik installed, so I installed that. But it didn't change a thing.