ASP.NET how to use __doPostBack from Custom JavaScript with Master/Content Pages -


In a simple ASPX page, I may have a custom JavaScript function postback as described in the normal page, using a link button Does:

  & lt; Asp: LinkButton id = "CreateFile" runat = "server" onclick = "CreateFile_Click" />  

The VB sub-routine with the code behind it is:

  create subfile_kill (system like sub-sender, system, by value, like a.  

and a Javascript custom function that does:

  __doPostBack ('CreateFile', '');  

Simple examples no longer work when I get the code taken to a content page with a corresponding page.

I know that the server control id is being changed, the generated HTML when a master page is included, and I am using the correct ID in javascript. As an example, I use Javascript in the generated HTML for the LinkButton ID '.' = CreateFile.ClientID%> ' Never less, I still can not figure out how to get a postback from Javascript when the master page is included. More precisely, the code with the master page in the mix will not compile, but the result is:

  'CreateFile_Click' is not a member of 'ASP.testmaster_aspx'  < / Pre> 

If I extract "CreateFile_Click" from onClick = LinkButton markup then it compiles but does not work simplified if onclick is removed from the simpler version without the main page, then it is expected either Does not work.

Any input on how to get a postback from a custom javascript function while using master pages will be highly appreciated.

Are you working hard to call a postback?

Try using

to obtain a valid handle in your JavaScript.

After writing a valid post back event reference, you can wrap it inside the local function, which you can call from the master page.

  if (window.myPostBackfunction) // check whether it is myPostBackFunction ();  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -