I have a formview based on an SQL Data Source see below. I have a formview
bound to it. The item insert template has a command button with a command
name insert. When I press it the insert doesn't take place in the database.
What obvious thing am I doing wrong!!? Regards, Chris. Could it be something
to do with the FormView1_ItemI nserted event.
<asp:SqlDataSou rce ID="SqlDataSour ce2" runat="server" ConnectionStrin g="<%$
ConnectionStrin gs:Balaces_JLK %>"
InsertCommand=" INSERT INTO tblBalanceGroup s(CompanyID, Description,
OpeningBalance) VALUES (@CompanyID, @Description, @OpeningBalance )"
SelectCommand=" SELECT [BalanceGroupID], [CompanyID], [Description],
[OpeningBalance] FROM [tblBalanceGroup s] WHERE ([CompanyID] = @CompanyID)">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="Drop DownList1" Name="CompanyID "
PropertyName="S electedValue"
Type="Int32" />
</SelectParameter s>
</asp:SqlDataSour ce>
<InsertItemTemp late>
<table>
<tr>
<td style="width: 140px">
Description</td>
<td style="width: 167px">
<asp:TextBox ID="txtDescript ion" runat="server" Text="<%#
Bind('Descripti on') %>"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 140px">
Opening Balance</td>
<td style="width: 167px">
<asp:TextBox ID="txtOpen" runat="server" Text="<%# Bind('OpeningBa lance')
%>"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 140px">
<asp:HiddenFiel d ID="HiddenField 1" runat="server" Value="<%#
Bind('CompanyID ') %>" />
</td>
<td style="width: 167px">
<asp:Button ID="Button1" runat="server" CommandName="in sert"
Text="Button" />
<asp:Button ID="Button2" runat="server" CommandName="ca ncel" Text="Button"
/>
</td>
</tr>
</table>
</InsertItemTempl ate>
</asp:FormView>