Click here to Skip to main content
15,902,634 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m using form view control (in insert mode) i can't find any method to add code in cs file
i want with this code
when i click on get result button
number 1 + number 2
and show in result text box
and then after click insert link button save all data to database
aspx code

============
XML
<div style="text-align: center">
how to add two number using form view</div>
<div>
<asp:FormView ID="FormView1" runat="server" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4"
DataSourceID="addnumber" DefaultMode="Insert" ForeColor="Black"
GridLines="Vertical" style="margin-right: 572px" Width="810px">
<FooterStyle BackColor="#CCCC99" />
<RowStyle BackColor="#F7F7DE" />
<EditItemTemplate>
n1:
<asp:TextBox ID="n1TextBox" runat="server" Text='<%# Bind("n1") %>' />
<br />
n2:
<asp:TextBox ID="n2TextBox" runat="server" Text='<%# Bind("n2") %>' />
<br />
result:
<asp:TextBox ID="resultTextBox" runat="server" Text='<%# Bind("result") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
<table style="width:100%;">
<tr>
<td class="style1">
number 1</td>
<td class="style2">
<asp:TextBox ID="n1TextBox" runat="server" Text='<%# Bind("n1") %>' />
</td>
<td>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
</td>
</tr>
<tr>
<td class="style1">
number 2</td>
<td class="style2">
<asp:TextBox ID="n2TextBox" runat="server"
ontextchanged="n2TextBox_TextChanged" Text='<%# Bind("n2") %>' />
</td>
<td>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Cancel" />
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="get result" />
</td>
<td>
</td>
</tr>
<tr>
<td class="style1">
result</td>
<td class="style2">
<asp:TextBox ID="resultTextBox" runat="server" Text='<%# Bind("result") %>' />
</td>
<td>
</td>
</tr>
</table>
<br />
</InsertItemTemplate>
<ItemTemplate>
n1:
<asp:Label ID="n1Label" runat="server" Text='<%# Bind("n1") %>' />
<br />
n2:
<asp:Label ID="n2Label" runat="server" Text='<%# Bind("n2") %>' />
<br />
result:
<asp:Label ID="resultLabel" runat="server" Text='<%# Bind("result") %>' />
<br />
</ItemTemplate>
<PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
</asp:FormView>
<asp:AccessDataSource ID="addnumber" runat="server"
DataFile="~/App_Data/test.mdb"
InsertCommand="INSERT INTO [add] (n1, n2, result) VALUES (?, ?, ?)"
SelectCommand="SELECT [n1], [n2], [result] FROM [add]">
</asp:AccessDataSource>
</div>
Posted
Updated 28-Sep-10 18:38pm
v3
Comments
Henry Minute 28-Sep-10 17:04pm    
Please do not use all upper case. On the internet this is regarded as shouting. Very rude!
Sandeep Mewara 29-Sep-10 4:49am    
Posting whole page would not help much. Please post the needed code snippet. That would keep readers interested in going through and reply back.

1 solution

Whatz your target in your program?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900