In a simple aspx page I can have a custom JavaScript function postback as described in http://www.xefteri.com/articles/show.cfm?id=18 The simple page uses a linkbutton:
<asp:LinkButton id="CreateFile" runat="server" onclick="CreateFile_Click" />
with code behind that has the VB subroutine:
Sub CreateFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
and a Javascript custom function that does:
__doPostBack('CreateFile','');
When I move the code to a content page with a corresponding master page the simple example no longer works.
I'm aware that server control IDs are changed in the generated HTML when a master page is involved, and I'm using the correct IDs in the Javascript. As an example, for the LinkButton ID I use '<%=CreateFile.ClientID%>' for the Javascript in the generated HTML. Never the less, I still can't figure out how to get postbacks from the Javascript when master pages are involved. More accurately, with a master page in the mix the code won't even compile but results in:
'CreateFile_Click' is not a member of 'ASP.testmaster_aspx'
If I remove onclick="CreateFile_Click" from the LinkButton markup it compiles but does not work. Similary if onclick is removed from the simpler version without a master page it does not work either, as expected.
Any input on how to get postback from a custom Javascript function when using master pages would be much appreciated.