Reputation: 3600
I have a master page and in this page __doPostBack
doesn't fire a post back. But I have another master page that __doPostBack works and it seems everything is the same with this other master page but __doPostBack does not work after all...
What could possibly be the reason for this?
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="xx.master.vb" Inherits="MyProject.xx" %>
<asp:Button type="button" ID="btnSwitchLanguage" Style="display: none" runat="server" />
__doPostBack("<%= btnSwitchLanguage.UniqueID %>", lang_id);
Private Sub btnSwitchLanguage_Click(sender As Object, e As EventArgs) Handles btnSwitchLanguage.Click
'Do Something
End Sub
Upvotes: 1
Views: 2310
Reputation: 3600
This is too weird but I solved the problem.
Here was the reason:
In project we override __doPostBack function, I didn't notice it. But in the other master page it was overriden just fine, in the one I'm talking about isn't.
In the other master page the __doPostBack func will become like this:
__doPostBack(Param1, Param2)
{
var theform;
if (window.navigator.appName.toLowerCase().indexOf('netscape') > -1)
{
theform = document.forms['aspnet…
But in the master I'm dealing with:
__doPostBack()
{
return;
}
It's weird because the order of javascript is the same too!
Anyway, I prevent __doPostBack from be overriden and the problem solved.
Upvotes: 0
Reputation: 2408
Have you try to put the code in function like this :
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="postBack();return false;"/>
<script type="text/javascript" language="javascript">
function postBack(){
var btnName = $get("<%=Btn2.ClientID%>").name;
__doPostBack(btnName,"");
}
</script>
Hopes this help you.
Upvotes: 1