I have a very simple asp.net page and something not working as it should be.
This is the structure of my page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Management/page.master" AutoEventWireup="true" CodeFile="Account.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:ScriptManager runat="server"></asp:ScriptManager>
<div class="contentWrapper">
<asp:Panel runat="server" ID="MainPanel" ClientIDMode="Static" CssClass="MainPanel" OnLoad="MainPanel_Load">
..........
..........
..........
..........
..........
..........
<asp:Panel runat="server" id="PasswordHolder" CssClass="rtl" Width="100%" ClientIDMode="Static">
<asp:TextBox runat="server" ID="PasswordInput" CssClass="block" TextMode="Password" />
<asp:LinkButton runat="server" CssClass="btn ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" ID="EditBtn" OnClick="EditBtn_Click"><span class="ui-button-text">submit</span></asp:LinkButton>
</asp:Panel>
</asp:Panel>
</asp:Content>
Now: I'm entering a text in the TextBox(PasswordInput) and clicking submit.
The Server catch the event and entering EditBtn_Click function.
BUT! PasswordInput.Text is empty.
What should I do to fix that?
Server Side Code:
protected void Page_Load(object sender, EventArgs e)
{
if (currentUser() == null)
{
Response.Redirect("Login.aspx", true);
}
if (!IsPostBack)
{
ViewState["ContactsSortExpression"] = "LastName";
ViewState["ContactsSortDirection"] = "ASC";
}
}
protected void EditBtn_Click(object sender, EventArgs e)
{
if (PasswordInput.Text == currentUser().Password)
{
//Do something
}
}