Tuesday, 27 August 2013

How do i store current time in database using javascript in asp.net

How do i store current time in database using javascript in asp.net

I have put Label outside the update panel ,so that if user get any message
related to error or confirmation it get seen on top right side without
Loading the whole page, but label is not getting any text , when i comment
update panel it works but it loads whole page that i don't won't . So
Help-Out .
Here is Page Design Code where 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 i used for 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 i used for label : this script i used when i commented the
update panel , so when page is loaded & if label get any text it disappear
after 10 sec .
<script>
$(document).ready(function () {
$('#<%= se.ClientID %>').fadeOut(10000);
});
</script>
C# code-behind used for label :Here i changing the css by using attribute
[disply:inline]
so whatever the text in label can be seen on button click .
protected void b1_Click(object sender, EventArgs e)
{
se.Attributes.Add("style", "display:inline");
se.Text = "Ok";
}

No comments:

Post a Comment