L
Lloyd Sheen
I have a simple page with a text box and a button. The code for the button
will insert the text into SQL Server. When I click the button no code gets
invoked (not even a page load). Other pages work just fine, I have deleted
the button several times and reinserted it with no luck.
VS2003/XP Pro/
VB Code (Codebehind):
Private Sub btnAddNewCategory_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddNewCategory.Click
Dim products As ASPNET.StarterKit.Commerce.ProductsDB = New
ASPNET.StarterKit.Commerce.ProductsDB
Dim psCategoryId As String
psCategoryId = products.AddNewCategory(Me.txtCategoryName.Text)
Me.lblStatus.Text = "Added new Category - " + Me.txtCategoryName.Text + "
Category ID = " + psCategoryId
BindCategories()
End Sub
Page Code :
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="CreateNewCategory.aspx.vb"
Inherits="ASPNET.StarterKit.Commerce.CreateNewCategory"%>
<%@ Register TagPrefix="uc1" TagName="_Menu" Src="_Menu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="_Header" Src="_Header.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>CreateNewCategory</title>
<LINK href="ASPNETCommerce.css" type=text/css rel=stylesheet >
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P><uc1:_Header id=_Header1 runat="server"></uc1:_Header></P>
<P>
<TABLE id=Table3 cellSpacing=1 cellPadding=1 width="100%" border=1>
<TR>
<TD>
<P><uc1:_Menu id=_Menu1 runat="server"></uc1:_Menu></P></TD>
<TD>
<TABLE id=Table1 cellSpacing=1 cellPadding=1 width="100%" border=1>
<TR>
<TD>
<P align=right>Current Categories : </P></TD>
<TD><aspropDownList id=ddCategoryList runat="server"
Width="214px"></aspropDownList></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR>
<TR>
<TD>
<P align=right>New Category Name : </P></TD>
<TD><asp:TextBox id=txtCategoryName
runat="server"></asp:TextBox></TD></TR>
<TR>
<TD>
<P align=right> </P></TD>
<TD><asp:Button id=btnAddNewCategory runat="server" Text="Add
Category"></asp:Button></TD></TR></TABLE></TD></TR></TABLE></P>
<P> </P>
<TABLE id=Table2 cellSpacing=1 cellPadding=1 width="100%" border=0>
<TR>
<TD>
<P
align=center><asp:Label id=lblStatus
runat="server">...</asp:Label></P></TD></TR></TABLE>
</form>
</body>
</HTML>
will insert the text into SQL Server. When I click the button no code gets
invoked (not even a page load). Other pages work just fine, I have deleted
the button several times and reinserted it with no luck.
VS2003/XP Pro/
VB Code (Codebehind):
Private Sub btnAddNewCategory_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btnAddNewCategory.Click
Dim products As ASPNET.StarterKit.Commerce.ProductsDB = New
ASPNET.StarterKit.Commerce.ProductsDB
Dim psCategoryId As String
psCategoryId = products.AddNewCategory(Me.txtCategoryName.Text)
Me.lblStatus.Text = "Added new Category - " + Me.txtCategoryName.Text + "
Category ID = " + psCategoryId
BindCategories()
End Sub
Page Code :
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="CreateNewCategory.aspx.vb"
Inherits="ASPNET.StarterKit.Commerce.CreateNewCategory"%>
<%@ Register TagPrefix="uc1" TagName="_Menu" Src="_Menu.ascx" %>
<%@ Register TagPrefix="uc1" TagName="_Header" Src="_Header.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>CreateNewCategory</title>
<LINK href="ASPNETCommerce.css" type=text/css rel=stylesheet >
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie3-2nav3-0">
</HEAD>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<P><uc1:_Header id=_Header1 runat="server"></uc1:_Header></P>
<P>
<TABLE id=Table3 cellSpacing=1 cellPadding=1 width="100%" border=1>
<TR>
<TD>
<P><uc1:_Menu id=_Menu1 runat="server"></uc1:_Menu></P></TD>
<TD>
<TABLE id=Table1 cellSpacing=1 cellPadding=1 width="100%" border=1>
<TR>
<TD>
<P align=right>Current Categories : </P></TD>
<TD><aspropDownList id=ddCategoryList runat="server"
Width="214px"></aspropDownList></TD></TR>
<TR>
<TD></TD>
<TD></TD></TR>
<TR>
<TD>
<P align=right>New Category Name : </P></TD>
<TD><asp:TextBox id=txtCategoryName
runat="server"></asp:TextBox></TD></TR>
<TR>
<TD>
<P align=right> </P></TD>
<TD><asp:Button id=btnAddNewCategory runat="server" Text="Add
Category"></asp:Button></TD></TR></TABLE></TD></TR></TABLE></P>
<P> </P>
<TABLE id=Table2 cellSpacing=1 cellPadding=1 width="100%" border=0>
<TR>
<TD>
<P
align=center><asp:Label id=lblStatus
runat="server">...</asp:Label></P></TD></TR></TABLE>
</form>
</body>
</HTML>