I didn't.
I tried adding it in the UserControl:
When I run this and click the button, there's no alert and the page posts back (so return false is never reached I guess). Doesn't work.Code:<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="ButtonUserControl.ascx.vb" Inherits="F1TimeTrials.ButtonUserControl" %> <script src="~/Scripts/jquery-1.4.1.js" type="text/javascript" /> <script type="text/javascript"> function buttonClicked(sender) { var label = $(obj).parent().parent().find('span:eq(0)'); alert('jup'); label[0].innerHTML += '|'; return false; } </script> <asp:Table runat="server"> <asp:TableRow runat="server"> <asp:TableCell runat="server"><asp:Button runat="server" ID="button" Text="Click!" OnClientClick="return buttonClicked(this);" /></asp:TableCell> <asp:TableCell runat="server"><asp:Label runat="server" ID="label" Text="" /></asp:TableCell> </asp:TableRow> </asp:Table>
So I tried it on the page instead:
Now, still no alert, but the page no longer posts back. This is a little strange to me... If it doesn't post back then it has reached return false right? But why then is there no alert? And no extra |...?Code:<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="SliderTest.aspx.vb" Inherits="F1TimeTrials.SliderTest" %> <%@ Register Src="~/Controls/ButtonUserControl.ascx" TagName="ButtonUserControl" TagPrefix="uc" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> <script src="~/Scripts/jquery-1.4.1.js" type="text/javascript" /> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <asp:ScriptManager runat="server" /> <uc:ButtonUserControl runat="server" /> </asp:Content>
I don't get it, why is this so hard? When I search for 'multiple user controls' I get at least 5-6 results with people having the exact same issue, but all they got was a few vague hints but no real solution... I don't understand how something this fundamental can be so difficult to accomplish :s




Reply With Quote