Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

asp:Dropdownlist onChange event not firing in IE but is in MozillaHelpful Member!(3) 

jelrod63 (Programmer) (OP)
20 Feb 07 17:56
I have an inline popup that has an asp:Dropdownlist that is NOT firing during the onChange event in IE but IS firing in Mozilla. Below is the my code. Any help would be greatly appreciated.

Code from my aspx page
[code]
<body>
<form id="upSellForm" runat="server">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<asp:DropDownList id="upsellDescriptionDropdown" runat="server" onChange="javascript:showMe(this);">
</asp:DropDownList>
</td>
</tr>
</table>
</form>

<script type="text/javascript">
function showMe(a)
{
alert("Here I am");
}
</script>
</body>
[code]
Helpful Member!(2)  adamroof (Programmer)
20 Feb 07 18:02
can u try just onchange="showMe(this);"

use all lower for the onchange

case sensitivity for IE, and no need to append the javascript: i think.
jelrod63 (Programmer) (OP)
20 Feb 07 18:11
Thanks for the reply adamroof.  I made the changes that you suggested but unfortunately it's still not working in IE.  I'm getting the following error from IE: "Object expected"
ca8msm (Programmer)
20 Feb 07 18:18
Have a look at what the rendered HTML is for that page as this will show what the problem is.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

adamroof (Programmer)
20 Feb 07 18:28
howabout this...

move your javascript to the head tag

CODE

<head>
<script type="text/javascript">
function showMe(a)
{
alert("Here I am");
}
</script>
</head>
<body>
<form id="upSellForm" runat="server">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<asp:DropDownList id="upsellDescriptionDropdown" runat="server" onChange="javascript:showMe(this);">
</asp:DropDownList>
</td>
</tr>
</table>
</form>
</body>
jelrod63 (Programmer) (OP)
20 Feb 07 18:51
Thanks again for replying adamroof I tried what you said by putting the javascript in the head tag but I'm still getting the same error in IE.
jelrod63 (Programmer) (OP)
20 Feb 07 18:55
To ca8msm:

Thanks for your reply ca8msm but when I try to view the rendered HTML from the inline popup I cannot do so to see what the problem is with my page. Any clue on how I can view source from an inline popup page?
ca8msm (Programmer)
21 Feb 07 3:20
Right click the page and use the view source option


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

adamroof (Programmer)
21 Feb 07 11:26
This works for me in IE6 and IE7

http://www.energf.com/testingfile.aspx

Does it work for you?

CODE

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testingfile.aspx.cs" Inherits="testingfile" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Testing Page</title>

    <script type="text/javascript">
        function showMe(a)
        {
            alert("Here I am");
        }
    </script>

</head>
<body>
    <form id="upSellForm" runat="server">
        <table border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <asp:DropDownList ID="upsellDescriptionDropdown" runat="server" onchange="showMe(this);">
                        <asp:ListItem Value="Select Me First"></asp:ListItem>
                        <asp:ListItem Value="Select Me Second"></asp:ListItem>
                        <asp:ListItem Value="Select Me Third"></asp:ListItem>
                        <asp:ListItem Value="Select Me Fourth"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
Helpful Member!  tperri (Programmer)
21 Feb 07 12:53
hi guys,

jelrod63 is a co-worker of mine, so I'm familiar with his issue.  The problem is that his code works fine on a regular aspx page, but when he opens the page that holds this code using some inline javascript (an aspx as a pop up), the event doesnt fire.

I also think he isn't getting the right click option to view source, either.

thanks for your help so far !
T
jelrod63 (Programmer) (OP)
21 Feb 07 13:27
adamroof

Thanks again for replying I really do appreciate it very much.  I'm still getting the same error in IE: "Object expected" but when I changed the following the onchange event is being fired (Notice the part onchange="alert('Here I am')">):

                        <asp:DropDownList ID="upsellDescriptionDropdown" runat="server" onchange="alert('Here I am')">
                            <asp:ListItem Value="Select Me First"></asp:ListItem>
                            <asp:ListItem Value="Select Me Second"></asp:ListItem>
                            <asp:ListItem Value="Select Me Third"></asp:ListItem>
                            <asp:ListItem Value="Select Me Fourth"></asp:ListItem>
                        </asp:DropDownList>


That does me no good though because I need to be able to Javascript functions.  Could it not be working because my code is in an inline popup and that is the reason it is not finding the object?  I have to use an inline popup for this part of my project though.  Now I'm really at a loss.
adamroof (Programmer)
21 Feb 07 13:27
can u post the inline popup function that opens this page?
jelrod63 (Programmer) (OP)
21 Feb 07 13:46
adamroof

here is the inline popup function you requested

var inlineObj = function(width, height, path, file, params, obj)
{
    showAllSelects();
    showFlash();

    divWidth = width;
    divHeight = height;
    if (path != '')
        url = "/" + path + "/_popups/" + file + "?" + params;
    else
        url = "/_popups/" + file + "?" + params;
        
    getRequest(obj);
}


Below is a portion of my actual code from my summary.aspx.cs page which is calling the upsells.aspx page through the inline popup (***NOTE: 'upsells.aspx' is the page where the asp:DropDownList is located. The summary.aspx page is located in a folder called packages and the upsells.aspx page is located in a folder within packages in a folder called _popups)

                StringWriter sw2 = new StringWriter();
                HtmlTextWriter tw2 = new HtmlTextWriter(sw2);
                    tw2.Write("<td valign=\"top\" width=\"110\" align=\"right\">");
                    tw2.Write("<img src=\"/images/layout/arrow_orange.gif\">&nbsp;");
                    tw2.Write(" <a href=\"javascript:;\" onclick=\"javascript:inlineObj(330, 250, 'packages', 'upsells.aspx', 'showID=");
                    tw2.Write(node.SelectSingleNode("showID").InnerText);
                    tw2.Write("','showUpsellDetails");
                    tw2.Write(node.SelectSingleNode("showID").InnerText);
                    tw2.Write("');\"  class=\"addTrip\">");
                    tw2.Write("add to my trip</a>&nbsp;&nbsp;</td>");
                    tw2.Write("</tr>");
                    tw2.Write("<tr>");
                    tw2.Write("<td valign=\"top\" colspan=\"2\" width=\"525\">");
adamroof (Programmer)
21 Feb 07 15:44
recap:
so the page pops up okay, and it opens the aspx file, in which the onchange event doenst work unless you place the actual alert inside the event. hmmmm

i bet theres an error, but its just not showin in IE, and mozilla handles it properly, but IE is not. Is it a plain jane page like our examples? any other js getting in the way? maybe write out the js that opened the popup and see if theres any extra spaces or something.

http://www.energf.com/testingfile.aspx

updated to open a popup, the alert still happens, but the popup is not allowing another popup.

You can right click in the pop up and select View Source, but my example wont get you much.

changed

CODE

    <script type="text/javascript">
        function showMe(a)
        {
            alert("Here I am, here comes a popup");
            window.open("testingfile.aspx","mywindow","status=0,toolbar=0,width=100,height=100");
        }        
    </script>

ca8msm (Programmer)
21 Feb 07 15:51
As adamroof has shown, there's nothing fundamentally wrong with the approach, it's the implementation that is the problem. We'll probably only find out the problem by being able to see what the browser sees.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close