Click here to Skip to main content
15,883,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I have javascript and css style applied for a page.

My problem is when i click the add new button, it does not postback coz it is in update panel.

But javascript and css style applied for the control is not working.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
            -moz-border-radius: 10px;
            -webkit-border-radius: 10px;
            background: #FFF;
            border: 1px solid #FF8855;
            border-radius: 30px;
            font: small Verdana;
            height: auto;
            padding: 5px;
            width: 300px;

    <script src="" type="text/javascript"></script>
 <script src="autohide.js" type="text/javascript"></script>

    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">


    <div style="height: 261px">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">

                <asp:Panel ID="Panel_MSG" runat="server" Visible="False">
        <div id="alert" class="round1">
            <asp:Label ID="lbl_msg" runat="server" Visible="False"></asp:Label>
                <div style="text-align: center">
                    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /></div>

        <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                <div style="text-align: center">
                    <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" /></div>

//========== code

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    public void dislyMSG(string MSGTXT)
        Panel_MSG.Visible = true;
        lbl_msg.Visible = true;
        lbl_msg.Text = MSGTXT.ToString();
    protected void Button2_Click(object sender, EventArgs e)
    protected void Button1_Click(object sender, EventArgs e)

[edit]code blocks fixed[/edit]
Updated 25-Nov-12 10:45am

1 solution

<asp:updatepanel id="UpdatePanel1" runat="server" EnableViewState="true"></asp:updatepanel>
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900