Hi Team,
I have 12buttons i want to change the background color of button when i am click on that button .but i want to change the last click button background color
Suppose total 12 buttons are there like button1, 2, 3..........
If i click button 1 it color change to green, after that if i click button2 
Button 2 color should change to green and button 1 color reset to its original (default color).
 
        <div>
            <center>
                <table>
                    <tr>
                        <th colspan="2"><span style="font: 200;"><u>New Booking</u></span></th>
                    </tr>
                    <tr>
                        <td>Appointment Id:
                        </td>
                        <td>
                            <asp:TextBox ID="txtAppointmentId" runat="server" ReadOnly="true"></asp:TextBox></td>
                    </tr>
                    <tr>
                        <td>Category:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlCategory" runat="server" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlCategory_SelectedIndexChanged">
                                <asp:ListItem Text="---Select Category---" Value=""></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td>Doctor:
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlDoctorUsers" runat="server" AutoPostBack="true" AppendDataBoundItems="true">
                                <asp:ListItem Text="---Select Doctor---" Value=""></asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">Date:<br />
                            <asp:Calendar ID="calDate" runat="server" OnSelectionChanged="calDate_SelectionChanged"></asp:Calendar>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="btnCheck" runat="server" Text="Check" OnClick="btnCheck_Click" />
                        </td>
                    </tr>
                </table>
            </center>
            <center>
                <table>
                    <tr>
                        <td>
                            <asp:Panel ID="pnlapptbtn" runat="server">
                                <asp:Button ID="btn9to10" runat="server" Text="9.00-10.00" OnClick="Submit" />
                                <asp:Button ID="btn10to1030" runat="server" Text="10.00-10.30" OnClick="Submit" />
                                <asp:Button ID="btn1030to11" runat="server" Text="10.30-11.00" OnClick="Submit" />
                                <asp:Button ID="btn11to12" runat="server" Text="11.00-12.00" OnClick="Submit" />
                                <asp:Button ID="btn12to01" runat="server" Text="12.00-01.00" OnClick="Submit" />
                                <asp:Button ID="btn01to02" runat="server" Text="01.00-02.00" OnClick="Submit" />
                                <asp:Button ID="btn03to04" runat="server" Text="03.00-04.00" OnClick="Submit" />
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Panel ID="pnlapptbtn1" runat="server">
                                <asp:Button ID="btn04to05" runat="server" Text="04.00-05.00" OnClick="Submit" />
                                <asp:Button ID="btn05to06" runat="server" Text="05.00-06.00" OnClick="Submit" />
                                <asp:Button ID="btn06to630" runat="server" Text="06.00-06.30" OnClick="Submit" />
                                <asp:Button ID="btn07to08" runat="server" Text="07.00-08.00" OnClick="Submit" />
                                <asp:Button ID="btn08to09" runat="server" Text="08.00-09.00" OnClick="Submit" />
                                <asp:Button ID="btn09to10" runat="server" Text="09.00-10.00" OnClick="Submit" />
                                <asp:Button ID="btn0to04" runat="server" Text="03.00-04.00" OnClick="Submit" />
                            </asp:Panel>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" align="center">
                            <asp:Button ID="btnBook" runat="server" Text="Book" />
                        </td>
                    </tr>
                </table>
            </center>
        </div>
 
    public partial class UsersBooking : System.Web.UI.Page
    {
        private Button lastButton;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                string CustId = "";
                pnlapptbtn.Visible = false;
                pnlapptbtn1.Visible = false;
                CustId = Request.QueryString["CustId"];
                txtAppointmentId.Text = CustId;
                //ddlCategory.Items.Add(new ListItem("--Select Category", ""));
                this.BindDropdown();
            }
        }
        private void BindDropdown()
        {
            string conString = ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString;
            using (SqlConnection con = new SqlConnection(conString))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "SELECT Category,Did FROM DoctorDetails";
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                ddlCategory.DataSource = dt;
                ddlCategory.DataTextField = "Category";
                ddlCategory.DataValueField = "Did";
                ddlCategory.DataBind();
            }
        }
        protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddlDoctorUsers.Items.Clear();
            ddlDoctorUsers.Items.Add(new ListItem("--Select Doctor", "-1"));
            string conString = ConfigurationManager.ConnectionStrings["DbConnection"].ConnectionString;
            using (SqlConnection con = new SqlConnection(conString))
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "SELECT Name,Did FROM DoctorDetails WHERE Did=@Did";
                cmd.Parameters.AddWithValue("@Did", ddlCategory.SelectedItem.Value);
                SqlDataAdapter sda = new SqlDataAdapter(cmd);
                DataTable dt = new DataTable();
                sda.Fill(dt);
                ddlDoctorUsers.DataSource = dt;
                ddlDoctorUsers.DataTextField = "Name";
                ddlDoctorUsers.DataValueField = "Did";
                ddlDoctorUsers.DataBind();
                if (ddlCategory.Items.Count > 1)
                {
                    ddlDoctorUsers.Enabled = true;
                }
                else
                {
                    ddlDoctorUsers.Enabled = false;
                }
            }
        }
        //protected void calDate_DayRender(object sender, DayRenderEventArgs e)
        //{
        //    e.Cell.BackColor = System.Drawing.Color.Empty;
        //    e.Cell.ForeColor = System.Drawing.Color.DarkRed;
        //    if (e.Day.IsOtherMonth)
        //    {
        //        e.Cell.BackColor = System.Drawing.Color.Black;
        //        e.Cell.Visible = false;
        //    }
        //}
        protected void btnCheck_Click(object sender, EventArgs e)
        {
            pnlapptbtn.Visible = true;
            pnlapptbtn1.Visible = true;
        }
        protected void calDate_SelectionChanged(object sender, EventArgs e)
        {
            string date = calDate.SelectedDate.ToString("dd/MM/yyy");
        }
        protected void Submit(object sender, EventArgs e)
        {
            // Change the background color of the button that was clicked
            Button current = (Button)sender;
            current.BackColor = Color.GreenYellow;
            // Revert the background color of the previously-colored button, if any
            if (lastButton != null)
            {
                lastButton.BackColor = System.Drawing.Color.White;
            }
            // Update the previously-colored button
            lastButton = current;
        }
    }