Results 1 to 2 of 2

Thread: Multiple ScriptManager.RegisterStartupScript Issue

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Multiple ScriptManager.RegisterStartupScript Issue

    I have a Counter on a textbox done in Javascript like twitter that counts the text entered. Now It works fine. The Textboxes get field with data and after that i want to calculate the renmaining Text. i have a code for that after i bind the textbox. So i have this


    Code:
      ScriptManager.RegisterStartupScript(Page, GetType(String), "FF", "InitializeCounter(" + "ctl00_ContentPlaceHolder_Main_Wizard1_Servitudes" + ",'ndacount2','bar','800');", True)
            ScriptManager.RegisterStartupScript(Page, GetType(String), "FF", "InitializeCounter(" + "ctl00_ContentPlaceHolder_Main_Wizard1_Introduction" + ",'NDAcount1','bar','800');", True)

    and i realized that it only calculate the textbox counts for only the First one and fail to do it for the second one. Maybe it does not like multiple RegisterStartupScript

    Thanks

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Multiple ScriptManager.RegisterStartupScript Issue

    A couple of things...

    1. You should give them different keys (you have both as FF) as this is supposed to be unique (See description here)
    2. You shouldn't hard-code the ID of the controls as you can't guarantee what this will be, instead use Control.ClientID

Posting Permissions

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



Click Here to Expand Forum to Full Width