Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > User Control causes events on page not to fire

Reply
Thread Tools

User Control causes events on page not to fire

 
 
Tebogo Tefo via .NET 247
Guest
Posts: n/a
 
      03-16-2005
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>
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBNVlA=?=
Guest
Posts: n/a
 
      03-16-2005
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>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User control causes postback but events do not fire Phil Johnson ASP .Net 0 05-17-2010 10:35 AM
VS2005: Events from User Control Stored in Session Do Not Fire HammRadio ASP .Net 2 10-24-2007 02:21 PM
Page events does not fire Hennie ASP .Net 0 07-06-2006 06:10 AM
events on page will not fire Brent Burkart ASP .Net 1 11-25-2003 01:51 PM
Will Events not fire in a datagrid if you set the datasource after the page load? KJ ASP .Net Datagrid Control 1 08-16-2003 12:26 PM



Advertisments