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
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