User Control causes events on page not to fire

Discussion in 'ASP .Net' started by Tebogo Tefo via .NET 247, Mar 16, 2005.

  1. Hi

    I have a user control that contains three dropdownlists that I populate according to
    what was selected in the other dropdownlist (i.e. populate dropdownlist2 after selecting a
    value in dropdownlist1)

    The App works fine if I don't add the user control that I created
    and all events on the page work and thus the App is perfect.

    But as soon as I add my user control (Here used as the TopNav for my page) all
    events on the page for all controls don't fire.

    I have check that the events are wired up correctly and that the AutoPostBack is
    set to true for the dropdownlists


    following is the html for the user control that I add to the page

    <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNav.ascx.cs" Inherits="Chevrolet.Navigation.TopNav" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
    <map name="chev_logo">
    <area shape="RECT" target="_new" coords="0,0,180,120" href="http://www.chevrolet.co.za">
    </map>
    <script>
    function itemChange()
    {
    <!--
    /* if(document.chevsites.site.value != "")
    {
    document.location = document.chevsites.site.value;
    }*/
    if(document.all.site.value != "")
    {
    document.location = document.all.site.value;
    }
    //-->
    }
    </script>
    <table cellSpacing="0" cellPadding="0">
    <TBODY>
    <tr>
    <td style="FONT-SIZE: 0px"><IMG height="0" src="Images/Chevrolet/spacer.gif" width="0">
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="0" src="Images/Chevrolet/spacer.gif" width="0">
    </td>
    </tr>
    <tr>
    <td style="FONT-SIZE: 0px" colSpan="2"><asp:Image id="imgMainTop" Runat="server"></asp:Image></td>
    </tr>
    <tr>
    <td style="FONT-SIZE: 0px"><asp:Image id="imgMainLeft" Runat="server"></asp:Image></td>
    <td style="FONT-SIZE: 0px"><asp:Image id="imgBanner" Runat="server"></asp:Image></td>
    </tr>
    <tr>
    <td style="FONT-SIZE: 0px" colSpan="2" valign="top"><IMG height="19" src="Images/Chevrolet/spacer.gif" width="0">
    </td>
    </tr>
    </TBODY>
    </table>
    <div style="LEFT: 210px; POSITION: absolute; TOP: 35px">
    <table cellSpacing="0" cellPadding="0" border="0" width="102%">
    <tr>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="3">
    </td>
    <td style="FONT-SIZE: 0px"><a class="aBlack" href="dealer_locator.jhtml">Your Nearest
    Dealer</a>
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><a class="aBlack" href="http://www.gmsa.com/finance.jhtml">Finance</a>
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><A class="aBlack" href="onlinebooking.jhtml">On Line Booking</A>
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><A class="aBlack" href="wallpaper.jhtml">Multi-Media</A>
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <td style="FONT-SIZE: 0px"><a class="aBlack" href="http://www.chevrolet.com" target="_new">International
    Links</a>
    </td>
    <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    </td>
    <form name="chevsites">
    <td align="right" width="0"><select style="FONT-SIZE: 9px; FONT-FAMILY: arial" onchange="itemChange()" name="site">
    <option selected>Models</option>
    <option value="http://www.chevrolet.co.za/sparkHome.jhtml">Spark</option>
    <option value="http://www.chevrolet.co.za/aveoHatchHome.jhtml">Aveo Hatch</option>
    <option value="http://www.chevrolet.co.za/aveoNotchHome.jhtml">Aveo Sedan</option>
    <option value="http://www.chevrolet.co.za/optraHome.jhtml">Optra</option>
    <option value="http://www.chevrolet.co.za/vivantHome.jhtml">Vivant</option>
    <option value="http://www.chevrolet.co.za/luminaHome.jhtml">Lumina</option>
    <option value="http://www.chevrolet.co.za/luminaUteHome.jhtml">Lumina UTE</option>
    </select>
    </td>
    </form>
    </tr>
    </table>
    </div>

    Can tell what I am doing wrong in my usercontrol

    Thanks in advance
    Tabzz

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>fr59ykjB0E6pr/KPr0Ud1w==</Id>
     
    Tebogo Tefo via .NET 247, Mar 16, 2005
    #1
    1. Advertising

  2. You have the auto events wire up turned off. This means either

    a) you have to turn it on
    b) you have to add delegates for the events you wish to bubble up.


    ---

    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************

    "Tebogo Tefo via .NET 247" wrote:

    > Hi
    >
    > I have a user control that contains three dropdownlists that I populate according to
    > what was selected in the other dropdownlist (i.e. populate dropdownlist2 after selecting a
    > value in dropdownlist1)
    >
    > The App works fine if I don't add the user control that I created
    > and all events on the page work and thus the App is perfect.
    >
    > But as soon as I add my user control (Here used as the TopNav for my page) all
    > events on the page for all controls don't fire.
    >
    > I have check that the events are wired up correctly and that the AutoPostBack is
    > set to true for the dropdownlists
    >
    >
    > following is the html for the user control that I add to the page
    >
    > <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNav.ascx.cs" Inherits="Chevrolet.Navigation.TopNav" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
    > <map name="chev_logo">
    > <area shape="RECT" target="_new" coords="0,0,180,120" href="http://www.chevrolet.co.za">
    > </map>
    > <script>
    > function itemChange()
    > {
    > <!--
    > /* if(document.chevsites.site.value != "")
    > {
    > document.location = document.chevsites.site.value;
    > }*/
    > if(document.all.site.value != "")
    > {
    > document.location = document.all.site.value;
    > }
    > //-->
    > }
    > </script>
    > <table cellSpacing="0" cellPadding="0">
    > <TBODY>
    > <tr>
    > <td style="FONT-SIZE: 0px"><IMG height="0" src="Images/Chevrolet/spacer.gif" width="0">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="0" src="Images/Chevrolet/spacer.gif" width="0">
    > </td>
    > </tr>
    > <tr>
    > <td style="FONT-SIZE: 0px" colSpan="2"><asp:Image id="imgMainTop" Runat="server"></asp:Image></td>
    > </tr>
    > <tr>
    > <td style="FONT-SIZE: 0px"><asp:Image id="imgMainLeft" Runat="server"></asp:Image></td>
    > <td style="FONT-SIZE: 0px"><asp:Image id="imgBanner" Runat="server"></asp:Image></td>
    > </tr>
    > <tr>
    > <td style="FONT-SIZE: 0px" colSpan="2" valign="top"><IMG height="19" src="Images/Chevrolet/spacer.gif" width="0">
    > </td>
    > </tr>
    > </TBODY>
    > </table>
    > <div style="LEFT: 210px; POSITION: absolute; TOP: 35px">
    > <table cellSpacing="0" cellPadding="0" border="0" width="102%">
    > <tr>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="3">
    > </td>
    > <td style="FONT-SIZE: 0px"><a class="aBlack" href="dealer_locator.jhtml">Your Nearest
    > Dealer</a>
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><a class="aBlack" href="http://www.gmsa.com/finance.jhtml">Finance</a>
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><A class="aBlack" href="onlinebooking.jhtml">On Line Booking</A>
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><A class="aBlack" href="wallpaper.jhtml">Multi-Media</A>
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG src="Images/Chevrolet/brown_dot.jpg">
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <td style="FONT-SIZE: 0px"><a class="aBlack" href="http://www.chevrolet.com" target="_new">International
    > Links</a>
    > </td>
    > <td style="FONT-SIZE: 0px"><IMG height="23" src="Images/Chevrolet/spacer.gif" width="5">
    > </td>
    > <form name="chevsites">
    > <td align="right" width="0"><select style="FONT-SIZE: 9px; FONT-FAMILY: arial" onchange="itemChange()" name="site">
    > <option selected>Models</option>
    > <option value="http://www.chevrolet.co.za/sparkHome.jhtml">Spark</option>
    > <option value="http://www.chevrolet.co.za/aveoHatchHome.jhtml">Aveo Hatch</option>
    > <option value="http://www.chevrolet.co.za/aveoNotchHome.jhtml">Aveo Sedan</option>
    > <option value="http://www.chevrolet.co.za/optraHome.jhtml">Optra</option>
    > <option value="http://www.chevrolet.co.za/vivantHome.jhtml">Vivant</option>
    > <option value="http://www.chevrolet.co.za/luminaHome.jhtml">Lumina</option>
    > <option value="http://www.chevrolet.co.za/luminaUteHome.jhtml">Lumina UTE</option>
    > </select>
    > </td>
    > </form>
    > </tr>
    > </table>
    > </div>
    >
    > Can tell what I am doing wrong in my usercontrol
    >
    > Thanks in advance
    > Tabzz
    >
    > -----------------------
    > Posted by a user from .NET 247 (http://www.dotnet247.com/)
    >
    > <Id>fr59ykjB0E6pr/KPr0Ud1w==</Id>
    >
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Mar 16, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brent Burkart

    events on page will not fire

    Brent Burkart, Nov 24, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    334
  2. Hennie

    Page events does not fire

    Hennie, Jul 6, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    330
    Hennie
    Jul 6, 2006
  3. HammRadio
    Replies:
    2
    Views:
    466
    HammRadio
    Oct 24, 2007
  4. Phil Johnson
    Replies:
    0
    Views:
    557
    Phil Johnson
    May 17, 2010
  5. KJ
    Replies:
    1
    Views:
    155
    Teemu Keiski
    Aug 16, 2003
Loading...

Share This Page