ASP.NET - Content Page Problem
<p>I have copied the controls and decorations from one content page to another, as they are almost similar. </p>

<p>But the following problems are happening:</p>

<pre><code>(1) Button events are not firing.

(2) One page is loaded multiple times.

(3) Some AJAX buttons are not visible.
</code></pre>

<p>Can any one tell me why is this happening?</p>

<pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="StudentControlPanel.aspx.cs" Inherits="Student_StudentControlPanel" Title="Untitled Page" %&gt;

&lt;%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %&gt;
&lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt;
    &lt;asp:Label ID="Label1" runat="server" Font-Bold="True" ForeColor="#C00000" Text="Label"
        Width="318px"&gt;&lt;/asp:Label&gt;&lt;br /&gt;
    &lt;ext:button id="btnLogOut" runat="server" autopostback="True" onclick="btnLogOut_Click"
        text="Log Out"&gt;&lt;/ext:button&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td style="width: 3px"&gt;
    &lt;table&gt;
        &lt;tr&gt;
            &lt;td colspan="5"&gt;
                &lt;strong&gt;&lt;span&gt;Student Control Panel&lt;/span&gt;&lt;/strong&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="right"&gt;
                Username :&lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:Label ID="labUsername" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
            &lt;td colspan="1" align="right"&gt;
                Roll No. :&lt;/td&gt;
            &lt;td colspan="1"&gt;
                &lt;asp:Label ID="labRollNo" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="right"&gt;
                Student Name :&lt;/td&gt;
            &lt;td colspan="2"&gt;
                &lt;asp:Label ID="labName" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
            &lt;td colspan="1" align="right"&gt;
                Reg No. :&lt;/td&gt;
            &lt;td colspan="1"&gt;
                &lt;asp:Label ID="labRegNo" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="right"&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
            &lt;/td&gt;
            &lt;td colspan="1" align="right"&gt;
                Department :&lt;/td&gt;
            &lt;td colspan="1"&gt;
                &lt;asp:Label ID="labDepartment" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="right"&gt;
            &lt;/td&gt;
            &lt;td colspan="2"&gt;
            &lt;/td&gt;
            &lt;td colspan="1"&gt;
            &lt;/td&gt;
            &lt;td colspan="1"&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td align="right" style="height: 21px"&gt;
            &lt;/td&gt;
            &lt;td colspan="2" style="height: 21px"&gt;
            &lt;/td&gt;
            &lt;td colspan="1" style="height: 21px"&gt;
            &lt;/td&gt;
            &lt;td colspan="1" style="height: 21px"&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
            &lt;/td&gt;
            &lt;td colspan="2" valign="top"&gt;&lt;table&gt;
                    &lt;tr&gt;
                        &lt;td colspan="3"&gt;
                            &lt;strong&gt;Mails&lt;/strong&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td colspan="3" style="text-align: center"&gt;
                            &lt;asp:Button ID="btnMail" runat="server" Height="24px" Text="Send Mail" Width="82px" OnClick="btnMail_Click" /&gt;
                        &lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;tr&gt;
                        &lt;td colspan="3"&gt;
                            &lt;asp:Button ID="btnOldMails" runat="server" Text="Old Mails" OnClick="btnOldMails_Click" /&gt;&lt;/td&gt;
                    &lt;/tr&gt;
                &lt;/table&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;br /&gt;
    &amp;nbsp;&lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="NoticeObjectDataSource" OnSelectedIndexChanging="GridView1_SelectedIndexChanging"&gt;
        &lt;Columns&gt;
            &lt;asp:CommandField HeaderText="View Notice" ShowSelectButton="True" /&gt;
            &lt;asp:BoundField DataField="NoticeCode" HeaderText="NoticeCode" SortExpression="NoticeCode" /&gt;
            &lt;asp:BoundField DataField="HangingDate" HeaderText="HangingDate" SortExpression="HangingDate" /&gt;
            &lt;asp:BoundField DataField="TeacherCode" HeaderText="TeacherCode" SortExpression="TeacherCode" /&gt;
            &lt;asp:BoundField DataField="TargetSessionCode" HeaderText="TargetSessionCode" SortExpression="TargetSessionCode" /&gt;
            &lt;asp:BoundField DataField="CourseCode" HeaderText="CourseCode" SortExpression="CourseCode" /&gt;
            &lt;asp:BoundField DataField="NoticeSubject" HeaderText="NoticeSubject" SortExpression="NoticeSubject" /&gt;
            &lt;asp:BoundField DataField="NoticeContent" HeaderText="NoticeContent" SortExpression="NoticeContent" /&gt;
            &lt;asp:BoundField DataField="ExpiryDate" HeaderText="ExpiryDate" SortExpression="ExpiryDate" /&gt;
            &lt;asp:CheckBoxField DataField="IsExpired" HeaderText="IsExpired" SortExpression="IsExpired" /&gt;
        &lt;/Columns&gt;
    &lt;/asp:GridView&gt;
    &lt;asp:ObjectDataSource 
        ID="NoticeObjectDataSource" 
        runat="server" 
        SelectMethod="GetNoticesBySessionCode"
        TypeName="Ice_Web_Portal.BO.Notice" OnSelecting="NoticeObjectDataSource_Selecting"&gt;
        &lt;SelectParameters&gt;
            &lt;asp:Parameter Name="sessionCode" Type="String" /&gt;
        &lt;/SelectParameters&gt;
    &lt;/asp:ObjectDataSource&gt;
    &lt;br /&gt;
    &lt;ext:scriptmanager id="ScriptManager1" runat="server" theme="Slate"&gt;&lt;/ext:scriptmanager&gt;
&lt;/asp:Content&gt;

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;



public partial class Student_StudentControlPanel : System.Web.UI.Page
{
    string sessionCode = string.Empty;
    string username = string.Empty;

    protected void Page_Load(object sender, EventArgs e)
    {
        username = (string)Request.QueryString["username"];

        Student std = Student.GetStudentByUsername(username);

        if (std != null)
        {
            labName.Text = std.StudentName;
            labUsername.Text = username;
            labRollNo.Text = std.RollNo;
            labRegNo.Text = std.RegNo;

            Dept dpt = std.Department;

            if (dpt != null)
            {
                labDepartment.Text = dpt.DeptName;
            }
            else
            {
                labDepartment.Text = "?";
            }

            sessionCode = std.SessionCode;
        }
    }

    protected void NoticeObjectDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
    {
        e.InputParameters["SessionCode"] = sessionCode;
    }

    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        int rowIndex = e.NewSelectedIndex;

        string noticeCode = GridView1.Rows[rowIndex].Cells[1].Text;
        string username = this.labUsername.Text;

        Server.Transfer(@"~/Student/ViewNoticeDetails.aspx?NoticeCode=" + noticeCode + "&amp;username=" + username);
    }

    protected void btnMail_Click(object sender, EventArgs e)
    {
        try
        {
            Server.Transfer(@"~/Student/StudentSendMail.aspx?username=" + username);
            //Response.Redirect(@"~/Student/StudentSendMail.aspx?username=" + username);
        }
        catch (Exception ex)
        {
            string m;
        }
    }
    protected void btnOldMails_Click(object sender, EventArgs e)
    {
        try
        {
            Server.Transfer(@"~/Student/StudentOldMail.aspx?username=" + username);
            //Response.Redirect(@"~/Student/StudentSendMail.aspx?username=" + username);
        }
        catch (Exception ex)
        {
            string m;
        }
    }

    protected void btnLogOut_Click(object sender, EventArgs e)
    {
        AspNetUtil util = new AspNetUtil(this.Page);
        util.DisposeCookie("user");

        Server.Transfer("~/Default.aspx");
    }
}
</code></pre>
