Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Javascript .NET4
I wrote code that works correctly for a single page, when a linkbutton is hovered over it causes javascript code to execute from a document ready, that causes a popup to show.
BUT when another linkbutton is clicked, causing a postback and then a C#linkbutton_click function to execute, the javascript functions no longer triggers!
 
<script type="text/javascript">
  $(document).ready(function (e) {....
     $('.cssclassname').hover(function (e) {
       call webservice here
       cause popup to show
     )};
});
</script>
 
in C# codebehind:
pageload()[
...set display of page and add original set of LinkButtons(added programatically)
}
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
           //get Calenday Month and year and set Calendar title with month and year
 
            //add new set of linkbuttons to page that should cause popups when hovered over
                (built programatically)
 
            //set popup data for balloon and picture
 
        }
 
when the linkbutton is hovered over, you can see the javascript function call displayed in
the lower left corner of the browser, but no popup or actual execution of javascript occurs
after LinkButton1_Click has executed!
 
how can this be fixed or how can i troubleshoot?
 
NOTE: using
    
var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_pageLoaded(PageLoadedEventHandler);
    function PageLoadedEventHandler() {<pre><pre lang="c#">
INSTEAD of document ready, the javascript now 'fires', but ajax still doesn't call
web service!
Posted 26-Feb-13 20:04pm
Edited 18-Mar-13 4:32am
v2
Comments
vinodkumarnie at 27-Feb-13 1:11am
   
When you click linkbutton postback is happens. So javascript will reset to initial values. because of this your popup is not showing. you should prevent postback to see popup on linkbutton click..
Member 9445358 at 27-Feb-13 9:26am
   
but when i hover over the linkbutton, the javascript should trigger again, but it doesn't
RockingDev at 27-Feb-13 1:43am
   
you should call js function on .cs file and write function properly like return true/falsec kind of things

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Code which you pasted haveing syntax issue.
$(document).ready(function (e) {
$('.cssclassname').hover(function (e) {
alert('here');-- your code is here
});
});
 
I tried to copy method on my page and it give syntax error may you facing issue due to that only or many be web service have some issue.
  Permalink  

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



Advertise | Privacy | Mobile
Web03 | 2.8.1411022.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100