Professional Web Applications Themes

accessing label in usercontrol from javascript - ASP.NET Building Controls

This is the scene: i have a user control IN a user control with a label inside named lblStato that must blink; i cannot use <BLINK> tag; having this in a webform a use this code Page.RegisterStartupScript("BlinkStatus", "<script>" _ & "setTimeout(BlinkStatusText,500);" _ & "function BlinkStatusText() { " _ & "if (doent.getElementById('lblStato').style.visibil ity=='visible') {" _ & "doent.getElementById(lblStato').style.visibili ty='hidden'} else {" _ & "doent.getElementById('lblStato').style.visibil ity='visible'}" _ & "setTimeout(BlinkStatusText,1000)}" _ & "</script>") and works fine, unluckily having a label in user control it doesn't work. I checked the html resulting and saw that, having the first user control named oMapDet and the nested ...

  1. #1

    Default accessing label in usercontrol from javascript

    This is the scene:
    i have a user control IN a user control with a label inside named lblStato that must blink; i cannot use <BLINK> tag; having this in a webform a use this code
    Page.RegisterStartupScript("BlinkStatus", "<script>" _
    & "setTimeout(BlinkStatusText,500);" _
    & "function BlinkStatusText() { " _
    & "if (doent.getElementById('lblStato').style.visibil ity=='visible') {" _
    & "doent.getElementById(lblStato').style.visibili ty='hidden'} else {" _
    & "doent.getElementById('lblStato').style.visibil ity='visible'}" _
    & "setTimeout(BlinkStatusText,1000)}" _
    & "</script>")
    and works fine, unluckily having a label in user control it doesn't work.
    I checked the html resulting and saw that, having the first user control named oMapDet and the nested one oMapDetGeneral the label is named oMapDet_oMapDetGeneral_lblStato; i tried using this name but still doesn't work.

    Two question:
    1) How to make this work again
    2) if my user control is in two webforms it can be called oMapDet, oMapDet2, oTest etc... How can i know in the user control source code what is my name in a particular context ?

    thanks,
    Fabrizio
    Fabrizio Guest

  2. #2

    Default RE: accessing label in usercontrol from javascript

    Seems like the web access to the newsgroups has temporary gone nuts (at least to me, i can get to my post just through search, instead i get december posts)

    However, for the history i got bot problems fixed
    1) the javascript problem what a typo :
    2) Using me.clientId gives the name that the control will have client side, perfect also with a user control inside a user contro

    Tks however to those who passed
    Fabrizio Guest

Similar Threads

  1. Accessing swf or javascript in different html
    By hylim in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 6th, 10:35 AM
  2. usercontrol that raise a javascript event
    By rom in forum ASP.NET Building Controls
    Replies: 1
    Last Post: December 8th, 12:28 AM
  3. Accessing UserControl properties - NullRef Exception
    By jat in forum ASP.NET Building Controls
    Replies: 0
    Last Post: June 12th, 02:09 AM
  4. __doPostBack generates JavaScript errors in UserControl encapsulating form
    By Stephen Miller in forum ASP.NET Building Controls
    Replies: 1
    Last Post: May 18th, 08:10 AM
  5. Accessing controls in template column with JavaScript
    By Peter Cresswell in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: July 16th, 08:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139