javascript - id and name attributes of HTML elements manipulated by ASP.NET -


There is a problem in my C # asp.NET application, where ID and name tags are modified with runtime on a prefix " Mainview_ "and" main view $ "respectively, then my code:

   

becomes:

  & lt; Input type = name = "MainView $ OKToContinueCheckInButton" value = "" id = "MainView_OKToContinueCheckInButton" submit "" visibility = "incorrect" style = "display: none" /> & Lt; Script type = "text / javascript" & gt; & Lt ;! - var Reply = Confirmation ("Some Warnings"); If (Answer) document.getElementById ('OKToContinueCheckInButton'). Click (); // -> & Lt; / Script & gt;  

getElementID () returns empty returns because the name has changed. Can anyone tell me why this is happening and if there is any way to disable ID and name changes, thanks!

-Sephrial

I think this will help you ...

  & lt; Script type = "text / javascript" & gt; & Lt ;! - var Reply = Confirmation ("Some Warnings"); If (Answer) click document.getElementById ('& lt;% = OKToContinueCheckInButton.ClientID% & gt;') () .; // -> & Lt; / Script & gt;  

This is the thing that does the trick

  <% = OKToContinueCheckInButton.ClientID%>  

Comments