Div fade out after data saved
Hi,   I have a div which shows message "data is saved..!" after data save. and i want that div to fade out after 5 second automatically(may be call from code behind but not on button click.)   How can i do this .   <html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<script type="text/javascript">
$(function () {
$('#btnTest').click(function () {
$('#divTest').fadeOut(5000);
});
});
</script>
<input id="btnTest" type="button" value="Test" />
<div id="divTest" style="background-color: Gray; color: White;">
Data is Saved...!
</div>
</form>
</body>
</html>  

i am not using any ajax call i just want to give call to my jquery from code behind. thats it.  

Thanks
May 18th, 2015 2:08am

Hi,

We can use the code like this:

string jquery = "$('#divTest').fadeOut(5000);"
Page.ClientScript.RegisterStartupScript(typeof(Page), "a key", "<script type=\"text/javascript\">"+ jquery +"</script>");

http://stackoverflow.com/questions/6178811/

http://www.c-sharpcorner.com/UploadFile/cd7c2e/call-jquery-from-code-behind-in-Asp-Net-application/

Since this case not related to SharePoint, I suggest you post it to a suitable forum, you will get more help and confirmed answers from there.

Best Regards

Free Windows Admin Tool Kit Click here and download it now
May 19th, 2015 1:46am

not working in my sharepoint project.but working in my asp.net web application.

how to make it workable in sharepoint

May 21st, 2015 9:59am

Hi,

We can create a web part in SharePoint and use the code in web part, here are two articles for your reference:

Creating a Web Part with Client-side Scripts (Anweshi Deverasetty)

http://blogs.msdn.com/b/sharepointdev/archive/2011/02/15/creating-a-web-part-with-client-side-script.aspx

How to run a popup window from code behind in web Part writen in C#

http://sharepoint.stackexchange.com/questions/52342/how-to-run-a-popup-window-from-code-behind-in-web-part-writen-in-c

Best Regards

Free Windows Admin Tool Kit Click here and download it now
May 24th, 2015 1:01am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics