Click here to Skip to main content
11,713,845 members (87,705 online)
Rate this: bad
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
in C# codebehind:
...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();
    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 19:04pm
Edited 18-Mar-13 3:32am
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
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.

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 330
1 CHill60 315
2 OriginalGriff 165
3 Andy Lanng 138
4 KarstenK 110
0 Sergey Alexandrovich Kryukov 365
1 CHill60 335
2 OriginalGriff 245
3 Andy Lanng 173
4 Richard MacCutchan 150

Advertise | Privacy | Mobile
Web01 | 2.8.150819.1 | Last Updated 18 Mar 2013
Copyright © CodeProject, 1999-2015
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