Click here to Skip to main content
15,884,605 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I have used a dropdownlist box in page but onSelectedIndexChanges is not working in IE10.
So I have a placed button and calling the button click same function via javascript.
But I have from problem. Kindly check the below code.

XML
Javascript 
<script type="text/javascript">
        function funcall()
        {
            <%= Page.ClientScript.GetPostBackEventReference(Button1, String.Empty) %>;
        }
</script>

Code:
<asp:DropDownList runat="server" ID="cmb_category" Name="cmb_category" AutoPostBack="true"
OnChange="funcall();">
<asp:ListItem Value="A" Text="A"></asp:ListItem>
<asp:ListItem Value="B" Text="B"></asp:ListItem>
<asp:ListItem Value="C" Text="C"></asp:ListItem>
</asp:DropDownList>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

Code Behind:

protected void Button1_Click(object sender, EventArgs e)
    {
        if (cmb_category.SelectedValue != "")
        {
\\code
}
}


But I am facing problem as __dopostback is undefined.
Posted
Comments
shiva2000 5-Oct-15 2:08am    
asd

Hi,
If you have jQuery on your page then it is so simple
JavaScript
function funcall()
       {
           var id= '<%= Button1.ClientID%>;
           $('#'+id).click();
       }
 
Share this answer
 
Comments
Ammar4556257 3-Oct-13 3:20am    
tanweer bhai, This code is working fine but if I put a label on aspx page and in code behind changed the label text. I found that the debugger hits on code behind but when the page re-renders the new text is not assigned to the label.
tanweer 3-Oct-13 3:26am    
Ok, will you show your code here so that i can check what is going wrong there.
Hey there,

first remove AutoPostBack="true" property of the DropDownList.

then, you can use the code suggest by tanweer in solution 3, or you can also try this:

JavaScript
function funcall()
        {
            document.getElementById('<%= Button1.ClientID%>').click();
        }


Hope it helps.

Azee
 
Share this answer
 
 
Share this answer
 
Comments
Arunprasath Natarajan 2-Oct-13 5:19am    
I will be coming to Code Project after google only. But Thanks let me weather it will help me or not.
Dholakiya Ankit 2-Oct-13 5:25am    
Yes check this out

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900