Click here to Skip to main content
15,884,983 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have this inside my ASP.NET body webpage:
<script type="text/javascript" charset="utf-8">
            var edited = function(note) {
                alert("Edited note with id " + note.id + ", new text is: " + note.text);
            }
            var created = function(note) {
                alert("Created note with id " + note.id + ", text is: " + note.text);
            }
            var deleted = function(note) {
                alert("Deleted note with id " + note.id + ", text is: " + note.text);
            }
            var moved = function(note) {
                alert("Moved note with id " + note.id + ", text is: " + note.text);
            }
            var resized = function(note) {
                alert("Resized note with id " + note.id + ", text is: " + note.text);
            }
            jQuery(document).ready(function() {
                var options = {
                    notes:[{"id":1,
                          "text":"Test Internet Explorer",
                          "pos_x": 50,
                          "pos_y": 50,
                          "width": 200,
                          "height": 200,
                        }]
                    ,resizable: true
                    ,controls: true
                    ,editCallback: edited
                    ,createCallback: created
                    ,deleteCallback: deleted
                    ,moveCallback: moved
                    ,resizeCallback: resized
                };
                jQuery("#notes").stickyNotes(options);
            });
        </script>


How can I change it to the page_load function from .cs ?
Posted
Updated 21-Dec-10 6:51am
v3

hi,
<br />
 Page.RegisterStartupScript("OnLoad","<script>functionName();</script>");


Hope This may help you..
 
Share this answer
 
Comments
Maxdd 7 22-Dec-10 8:59am    
But I can use only functions ?
You can create the entire script in pageload at server side and register it using ScriptManager
 
Share this answer
 
Comments
Maxdd 7 21-Dec-10 12:57pm    
But how can I place the javascript inside c# ?
Brij 21-Dec-10 13:03pm    
like a simple string.As your first function would be like
string jsscript=" <script type="text/javascript" charset="utf-8">
var edited = function(note) {
alert('Edited note with id '" + note.id + "', new text is: '" + note.text"');
}; </script>"

something as above.And add more code as per required and register it
Maxdd 7 21-Dec-10 13:20pm    
I appreciate your help, but that way I get a lot of syntax errors.
use webrowser.Document.invokescipt("name of methode", args);
 
Share this answer
 
Comments
Maxdd 7 22-Dec-10 8:59am    
One more time, if I want to use a lot of code like I have on my question, how do I do ?

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