oops one more thing ... the controls are dynamically loaded on Page_Load, not sure if i am missing the events fer some reason.
>>> [EMAIL PROTECTED] 06/14/2005 3:09:59 PM >>> arrrggghhh and its drivin' me nuts. i have an app that is using lots of webControls am getting a little thrown. I have a VB web control that has some asp:buttons on it that are within an asp:panel. the events will not fire no matter what i do. i did a little work around for one event (selectedIndexChange) that would not fire, but now i am trying to get the button_Click event to fire ... no go. any help would be very cool ... kinda pulling hair here below is the code: ..... ascx page .... <%@ Control Language="vb" AutoEventWireup="false" Codebehind="EditDept.ascx.vb" Inherits="Walkabouts.EditDept" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> <script language=javascript> function loadCalendar(sObj) { window.open('calendarSelection.aspx?object=' + sObj,'theWin','scrollbars=0,menubar=0,locationbar=0,titlebar=0,resizab le=0,width=250,height=225,left=370,top=270,alwaysRaised'); } ///////////////////////////////// // this is the kludge for the selectedIndex event not firing //////////////////////////////// function cboDept_Change() { if (document.frmMain._ctl0_cboDept.options [document.frmMain._ctl0_cboDept.selectedIndex].value > 0) { document.location.href= 'index.aspx?ID=<%= Request.Querystring("ID") %>&SDID=<%= Request.Querystring("SDID") % >&DeptID=' + document.frmMain._ctl0_cboDept.options [document.frmMain._ctl0_cboDept.selectedIndex].value; } } </script> <div class="Content"> <table width=563 height=800 align=center> <tr> <td valign=top> <P class="Heading"> <img src="images/global/tool.png" style="background-color:#000000;border- color:#000000;border-style:solid;border-width:1px;padding- left:1px;padding-right:1px;padding-bottom:1px;padding-top:1px;"> <asp:Label ID="lblHeading" Runat=server></asp:Label> </P> <asp:Label ID="lblMode" Runat=server CssClass=Mode></asp:Label> <p style="LEFT: 30px; POSITION: absolute; TOP: 30px"> <span style="LEFT: 5px; POSITION: absolute; TOP: 15px;font-family:Sans-Serif;font- size:12;font-weight:500;">Department:</span> <span style="LEFT: 100px; POSITION: absolute; TOP: 15px;"><select id="cboDept" runat=server onchange="cboDept_Change();" NAME="cboDept"></select></span> <span style="LEFT: 100px; POSITION: absolute; TOP: 15px;"><asp:TextBox ID=txtDept Runat=server Visible=true></asp:TextBox></span> <span style="LEFT: 275px; POSITION: absolute; TOP: 15px;cursor:hand;"><img src="../images/global/PlusBox.png" alt="Add a new department" id="imgAddReturn" runat=server></span> <asp:Panel ID=pnlUpdateButtons Runat=server EnableViewState=True> <span style="LEFT: 100px; POSITION: absolute; TOP: 90px;"> <asp:Button ID=btnUBUpdate CssClass=button Text="Update" Runat=server CommandName="Update" OnCommand="Command_Click"></asp:Button> </span> <span style="LEFT: 190px; POSITION: absolute; TOP: 90px;"> <asp:Button ID="btnUBDelete" CssClass=button Text="Delete" Runat=server CommandName="Delete" OnCommand="Command_Click"></asp:Button> </span> <span style="LEFT: 280px; POSITION: absolute; TOP: 90px;"> <asp:Button ID="btnUBReset" CssClass=button Text="Reset" Runat=server CommandName="Reset" OnCommand="Command_Click"></asp:Button> </span> </asp:Panel> <asp:Panel ID="pnlAddButtons" Runat=server EnableViewState=True> <span style="LEFT: 150px; POSITION: absolute; TOP: 90px;"> <asp:Button ID="btnAdd" CssClass=button Text="Add" Runat=server CommandName="Add" OnCommand="Command_Click"></asp:Button> </span> <span style="LEFT: 220px; POSITION: absolute; TOP: 90px;"> <asp:Button ID="btnABReset" CssClass=button Text="Reset" Runat=server CommandName="Reset" OnCommand="Command_Click"></asp:Button> </span> </asp:Panel> <span style="LEFT: 150px; POSITION: absolute; TOP: 590px;"> <asp:Button ID=btnTest Text=Test Runat=server CommandName="TEST" OnCommand="Command_Click" Runat=server></asp:Button> </span> </p> </td> </tr> </table> </div> .......................... .......................... this is the VB Code: .......................... .......................... Public Class EditDept Inherits System.Web.UI.UserControl #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Protected WithEvents cboDept As System.Web.UI.HtmlControls.HtmlSelect Protected WithEvents txtDept As System.Web.UI.WebControls.TextBox Protected WithEvents lblHeading As System.Web.UI.WebControls.Label Protected WithEvents lblMode As System.Web.UI.WebControls.Label Protected WithEvents imgAddReturn As System.Web.UI.HtmlControls.HtmlImage Protected WithEvents pnlAddButtons As System.Web.UI.WebControls.Panel Protected WithEvents pnlUpdateButtons As System.Web.UI.WebControls.Panel Protected WithEvents btnUBUpdate As System.Web.UI.WebControls.Button Protected WithEvents btnUBDelete As System.Web.UI.WebControls.Button Protected WithEvents btnUBReset As System.Web.UI.WebControls.Button Protected WithEvents btnABAdd As System.Web.UI.WebControls.Button Protected WithEvents btnABReset As System.Web.UI.WebControls.Button Protected WithEvents btnTest As System.Web.UI.WebControls.Button 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim oData As New CDataAccess Dim dtrDept As OracleClient.OracleDataReader If Not Page.IsPostBack Then Try If Request.QueryString("DeptID") > 0 Then lblHeading.Text = "Edit Departments" lblMode.Text = "Edit Mode" pnlAddButtons.Visible = False pnlUpdateButtons.Visible = True imgAddReturn.Src = "../images/global/refresh_icon.gif" imgAddReturn.Alt = "Show all departments" imgAddReturn.Attributes.Remove ("onclick") imgAddReturn.Attributes.Add ("onclick", "document.location.href='index.aspx?ID=" & Request.QueryString("ID") & "&SDID=" & Request.QueryString("SDID") & "';") cboDept.Visible = False txtDept.Visible = True oData.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString") dtrDept = oData.GetDepartment (Request.QueryString("DeptID")) While dtrDept.Read() txtDept.Text = dtrDept ("Department") End While ElseIf Request.QueryString("DeptID") = "" Then lblHeading.Text = "Edit Departments" lblMode.Text = "Selection Mode" imgAddReturn.Attributes.Add ("onclick", "document.location.href='index.aspx?ID=" & Request.QueryString("ID") & "&SDID=" & Request.QueryString("SDID") & "&DeptID=0';") pnlAddButtons.Visible = False pnlUpdateButtons.Visible = True cboDept.Visible = True txtDept.Visible = False oData.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString") dtrDept = oData.GetDepartment (0) cboDept.Items.Add(New ListItem ("-- Select a department --", 0)) While dtrDept.Read() cboDept.Items.Add(New ListItem(dtrDept("Department"), dtrDept("DepartmentID"))) End While Else lblHeading.Text = "Edit Departments" lblMode.Text = "Addition Mode" pnlAddButtons.Visible = True pnlUpdateButtons.Visible = False cboDept.Visible = False txtDept.Visible = True imgAddReturn.Src = "../images/global/refresh_icon.gif" imgAddReturn.Alt = "Show all departments" imgAddReturn.Attributes.Remove ("onclick") imgAddReturn.Attributes.Add ("onclick", "document.location.href='index.aspx?ID=" & Request.QueryString("ID") & "&SDID=" & Request.QueryString("SDID") & "';") End If Catch ex As Exception End Try Else cboDept.Visible = False txtDept.Visible = True oData.ConnectionString = ConfigurationSettings.AppSettings("ConnectionString") dtrDept = oData.GetDepartment(1) While dtrDept.Read() txtDept.Text = dtrDept("Department") End While End If End Sub Public Sub Command_Click(ByVal sender As Object, ByVal e As CommandEventArgs) Dim sName As String sName = e.CommandName End Sub Private Sub btnTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTest.Click Dim sTest As String sTest = "TEST" End Sub Private Sub btnTest_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) Handles btnTest.Command Dim sTest As String sTest = "TEST2" End Sub End Class Yahoo! Groups Links [Non-text portions of this message have been removed] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
