I positioned the Label outside the update panel so that any error or confirmation messages would be displayed on the top right side without reloading the entire page. However, the label is not displaying any text. When I comment out the update panel, it works but it causes the whole page to reload, which is not what I want. Can someone help me with this issue?
Below is the Page Design Code where the label is set:
<div>
<asp:Label ID ="se" CssClass="mess" runat="server" ClientIDMode="Static" >
</asp:Label>
</div>
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger EventName="Click" ControlID="b1" />
</Triggers>
<ContentTemplate>
<div>
<asp:Button ID="b1" runat="server" Text="Submit." />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
CSS used for the Label:
.mess{
z-index:3;
-o-box-shadow:1px 1px 1px 1px #322e2e;
-moz-box-shadow:1px 1px 1px 1px #322e2e;
-webkit-box-shadow:1px 1px 1px 1px #322e2e;
box-shadow:1px 1px 1px 1px #322e2e;
float:right;
padding:10px;
border-radius:25px 25px 25px 0;
background-color:#5db620;
color:#f1eded;
margin:auto 5% auto auto;
display:none;
text-wrap:normal;
}
Javascript used for the Label:
<script>
$(document).ready(function () {
$('#<%= se.ClientID %>').fadeOut(10000);
});
</script>
C# code-behind used for the label: Here, I change the CSS by using the attribute [display:inline]
So, the text in the label can be seen on button click.
protected void b1_Click(object sender, EventArgs e)
{
se.Attributes.Add("style", "display:inline");
se.Text = "Ok";
}