Modalpopup not showing in Chrome from javascript function

I am having a modalpopup extender in my aspx page. It is working fine in mozilla and IE but Modalpopup not showing in Chrome from javascript function.

1. Calling javascript function from html link

<a href=javascript:vinModal('BEST','%'); > Best Practices/Results </a> 

2. the function which call codebehind


<script type="text/javascript" >
    function vinModal( i, j )
        {
 
     document.getElementById('<%=HiddenField1.ClientID %>').value = j;
     document.getElementById('<%=HiddenField2.ClientID %>').value = i;
     /*  document.getElementById('<%=lblPop.ClientID%>').innerHTML = "vinod";
       $find('ModalPopupExtender1').show();
     document.getElementById('<%=LinkButton1.ClientID%>').click();   // this line doesnt work in chrome*/
       __doPostBack('LinkButton1','hi');
    }
</script>

3. The codebehind function which activate modalpopupextender.


Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
    
        Session("pro") = HiddenField1.Value.ToString
        Session("type") = HiddenField2.Value.ToString
        lblPop.Text = Session("pro").ToString & " - " & Session("type").ToString
        display1.Visible = True
        If Session("pro") IsNot Nothing And Session("type") IsNot Nothing Then
            ModalPopupExtender1.Show()
        End If


        'Label1.Text = Hidden1.Value & Hidden2.Value
    End Sub


4. Along with this add add below code in web.config:



or add below line in page directive

enableEventValidation="false"


<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" enableEventValidation="false" %>


If you not put this line it will throw error on __dopostback
MESSAGE : Invalid postback or callback argument.  Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For secu...

Now modalpopup start to show in google chrome.
earlier i was using only  document.getElementById('<%=LinkButton1.ClientID%>').click(); which was working fine in IE and mozilla but chrome dosenot accept this type of coding may be... so i replaced it with
  __doPostBack('LinkButton1','hi');


- Vinod Kotiya
www.vinodkotiya.com


Comments

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers