469,344 Members | 6,380 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,344 developers. It's quick & easy.

User Control causes events on page not to fire

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>
Nov 19 '05 #1
1 1502
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>

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Daniel Armstrong | last post: by
4 posts views Thread by Barb | last post: by
4 posts views Thread by thomson | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.