I created an ASP formview for my SharePoint server with SharePoint Designer actually using the update template which contain some of textboxes, reference to below code I need help to make the following calculations: Cost_CustomerTextBox = (QuantityTextBox
* CostItem_1TextBox) + CostItem_2TextBox + CostItem_3TextBox + CostItem_4TextBox + CostItem_5TextBox + CostItem_6TextBox + CostItem_7TextBox + CostItem_8TextBox + CostItem_9TextBox
That looks like something from code-behind. You didn't post any.
Note: IDs can not have spaces in them. (Or is that just from copying the message?)
Superguppie.
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.
Ahmed Elbend...
0 Points
5 Posts
ASP.Net FromView
Apr 08, 2012 02:15 PM|LINK
I created an ASP formview for my SharePoint server with SharePoint Designer actually using the update template which contain some of textboxes, reference to below code I need help to make the following calculations: Cost_CustomerTextBox = (QuantityTextBox * CostItem_1TextBox) + CostItem_2TextBox + CostItem_3TextBox + CostItem_4TextBox + CostItem_5TextBox + CostItem_6TextBox + CostItem_7TextBox + CostItem_8TextBox + CostItem_9TextBox
Source Code:
<asp:SqlDataSource runat="server" id="Customer" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [C_id], [Cust_nam] FROM [Trans_Customer] order by [Cust_nam]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="Forwarder" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [C_id], [Cust_nam] FROM [Trans_Customer] where [cust_typ] = 'Forwarder' order by [Cust_nam]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="City" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=MAADI04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="Select distinct City from trans_price"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="contractor" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT distinct[Contractor] FROM [Trans_Price]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="operation" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=MAADI04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [T_id], [Customer], [Forwarder], [CargoTyp], [ContTyp], [Quantity], [ContNums], [Operation], [Contractor], [Voyage], [Destination], [TDate], [CostItem_1], [CostItem_2], [CostItem_3], [CostItem_4], [CostItem_5], [CostItem_6], [CostItem_7], [CostItem_8], [CostItem_9], [Cost_Contranctor], [Cost_Customer], [Status] FROM [Trans_Order] WHERE ([T_id] = @T_id)" DeleteCommand="DELETE FROM [Trans_Order] WHERE [T_id] = @T_id" InsertCommand="INSERT INTO [Trans_Order] ([Customer], [Forwarder], [CargoTyp], [ContTyp], [Quantity], [ContNums], [Operation], [Contractor], [Voyage], [Destination], [TDate], [CostItem_1], [CostItem_2], [CostItem_3], [CostItem_4], [CostItem_5], [CostItem_6], [CostItem_7], [CostItem_8], [CostItem_9], [Cost_Contranctor], [Cost_Customer], [Status]) VALUES (@Customer, @Forwarder, @CargoTyp, @ContTyp, @Quantity, @ContNums, @Operation, @Contractor, @Voyage, @Destination, @TDate, @CostItem_1, @CostItem_2, @CostItem_3, @CostItem_4, @CostItem_5, @CostItem_6, @CostItem_7, @CostItem_8, @CostItem_9, @Cost_Contranctor, @Cost_Customer, @Status)" UpdateCommand="UPDATE [Trans_Order] SET [Customer] = @Customer, [Forwarder] = @Forwarder, [CargoTyp] = @CargoTyp, [ContTyp] = @ContTyp, [Quantity] = @Quantity, [Operation] = @Operation, [Contractor] = @Contractor, [Destination] = @Destination, [TDate] = @TDate, [CostItem_1] = @CostItem_1, [CostItem_2] = @CostItem_2, [CostItem_3] = @CostItem_3, [CostItem_4] = @CostItem_4, [CostItem_5] = @CostItem_5, [CostItem_6] = @CostItem_6, [CostItem_7] = @CostItem_7, [CostItem_8] = @CostItem_8, [CostItem_9] = @CostItem_9, [Cost_Contranctor] = @Cost_Contranctor, [Cost_Customer] = @Cost_Customer, [Status] = @Status WHERE [T_id] = @T_id"> <SelectParameters> <asp:controlparameter ControlID="TextBox1" PropertyName="Text" Name="T_id" Type="Int32" /> </SelectParameters> <DeleteParameters> <asp:parameter Name="T_id" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:parameter Name="Customer" Type="String" /> <asp:parameter Name="Forwarder" Type="String" /> <asp:parameter Name="CargoTyp" Type="String" /> <asp:parameter Name="ContTyp" Type="String" /> <asp:parameter Name="Quantity" Type="Decimal" /> <asp:parameter Name="Operation" Type="String" /> <asp:parameter Name="Contractor" Type="String" /> <asp:parameter Name="Destination" Type="String" /> <asp:parameter Name="TDate" Type="DateTime" /> <asp:parameter Name="CostItem_1" Type="Decimal" /> <asp:parameter Name="CostItem_2" Type="Decimal" /> <asp:parameter Name="CostItem_3" Type="Decimal" /> <asp:parameter Name="CostItem_4" Type="Decimal" /> <asp:parameter Name="CostItem_5" Type="Decimal" /> <asp:parameter Name="CostItem_6" Type="Decimal" /> <asp:parameter Name="CostItem_7" Type="Decimal" /> <asp:parameter Name="CostItem_8" Type="Decimal" /> <asp:parameter Name="CostItem_9" Type="Decimal" /> <asp:parameter Name="Cost_Contranctor" Type="Decimal" /> <asp:parameter Name="Cost_Customer" Type="Decimal" /> <asp:parameter Name="Status" Type="String" /> <asp:parameter Name="T_id" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:parameter Name="Customer" Type="String" /> <asp:parameter Name="Forwarder" Type="String" /> <asp:parameter Name="CargoTyp" Type="String" /> <asp:parameter Name="ContTyp" Type="String" /> <asp:parameter Name="Quantity" Type="Decimal" /> <asp:parameter Name="ContNums" Type="String" /> <asp:parameter Name="Operation" Type="String" /> <asp:parameter Name="Contractor" Type="String" /> <asp:parameter Name="Voyage" Type="Int32" /> <asp:parameter Name="Destination" Type="String" /> <asp:parameter Name="TDate" Type="DateTime" /> <asp:parameter Name="CostItem_1" Type="Decimal" /> <asp:parameter Name="CostItem_2" Type="Decimal" /> <asp:parameter Name="CostItem_3" Type="Decimal" /> <asp:parameter Name="CostItem_4" Type="Decimal" /> <asp:parameter Name="CostItem_5" Type="Decimal" /> <asp:parameter Name="CostItem_6" Type="Decimal" /> <asp:parameter Name="CostItem_7" Type="Decimal" /> <asp:parameter Name="CostItem_8" Type="Decimal" /> <asp:parameter Name="CostItem_9" Type="Decimal" /> <asp:parameter Name="Cost_Contranctor" Type="Decimal" /> <asp:parameter Name="Cost_Customer" Type="Decimal" /> <asp:parameter Name="Status" Type="String" /> </InsertParameters> </asp:SqlDataSource> </p> <table style="width: 100%"> <tr> <td class="style1"> Please Insert the Order Number and Press Enter Key <asp:TextBox runat="server" id="TextBox1" AutoPostBack="True"> </asp:TextBox> </td> </tr> <tr> <td class="style1"> </td> </tr> <tr> <td class="style1"> <p> <asp:FormView runat="server" id="FormView1" DataSourceID="operation" DataKeyNames="T_id" DefaultMode="Edit" Width="924px"> <EditItemTemplate> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td> </td> <td> </td> </tr> <tr> <td>Customer</td> <td>Forwarder</td> </tr> <tr> <td> <asp:DropDownList Text='<%# Bind("Customer") %>' runat="server" id="DDL_customer" DataSourceID="customer" AppendDataBoundItems="True" DataValueField="cust_nam" DataTextField="cust_nam" Font-Size="X-Small" Width="100%"> <asp:ListItem>Select..</asp:ListItem> </asp:DropDownList> </td> <td> <asp:DropDownList Text='<%# Bind("Forwarder") %>' runat="server" id="DDL_Forwarder" DataSourceID="Forwarder" AppendDataBoundItems="True" DataValueField="cust_nam" DataTextField="cust_nam" Font-Size="X-Small" Width="100%"> <asp:ListItem>Select..</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td>Date</td> <td> <asp:TextBox Text='<%# Bind("Tdate") %>' runat="server" id="TextBox10" /> </td> <td> </td> <td> </td> <td>Status</td> <td> <asp:DropDownList Text='<%# Bind("Status") %>' runat="server" id="DDL_status" Font-Size="X-Small" Width="219px"> <asp:ListItem Value="">Select..</asp:ListItem> <asp:ListItem>Pinding</asp:ListItem> <asp:ListItem>Collected</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Cargo Type</td> <td> <asp:TextBox Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypTextBox" readonly="true" /> </td> <td>Container Type</td> <td> <asp:DropDownList Text='<%# Bind("ContTyp") %>' runat="server" id="DDL_cont_typ" Font-Size="X-Small" Width="128px"> <asp:ListItem>Select..</asp:ListItem> <asp:ListItem>20 Feet</asp:ListItem> <asp:ListItem>40 Feet</asp:ListItem> <asp:ListItem>Reefer</asp:ListItem> </asp:DropDownList> </td> <td>Quantity</td> <td> <asp:TextBox Text='<%# Bind("Quantity") %>' runat="server" id="QuantityTextBox" /> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Operation</td> <td> <asp:DropDownList Text='<%# Bind("Operation") %>' runat="server" id="DDL_operation" Font-Size="X-Small" Width="219px"> <asp:ListItem>Select..</asp:ListItem> <asp:ListItem>Release and Transport</asp:ListItem> <asp:ListItem>Release Only</asp:ListItem> </asp:DropDownList> </td> <td>Contractor</td> <td> <asp:DropDownList Text='<%# Bind("Contractor") %>' runat="server" id="DDL_contractor" DataSourceID="Contractor" AppendDataBoundItems="True" DataValueField="Contractor" DataTextField="Contractor" Font-Size="X-Small" Width="125px"> <asp:ListItem Value="">Select..</asp:ListItem> </asp:DropDownList> </td> <td>Destination</td> <td> <asp:DropDownList Text='<%# Bind("Destination") %>' runat="server" id="DDL_city" DataSourceID="city" AppendDataBoundItems="True" DataValueField="city" DataTextField="city" Font-Size="X-Small" Width="128px"> <asp:ListItem Value="">Select..</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td class="style1" style="width: 301px">1</td> <td> <asp:TextBox Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">2</td> <td> <asp:TextBox Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">3</td> <td> <asp:TextBox Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">4</td> <td> <asp:TextBox Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">5</td> <td> <asp:TextBox Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">6</td> <td> <asp:TextBox Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">7</td> <td> <asp:TextBox Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">8</td> <td> <asp:TextBox Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">9</td> <td> <asp:TextBox Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9TextBox" /> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Contractor Cost</td> <td> <asp:TextBox Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorTextBox" /> </td> <td>Customer Cost</td> <td> <asp:TextBox Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerTextBox" /> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> Please Remember to Check the Status<br> <br> <br /> <br /> <asp:LinkButton runat="server" Text="Update" CommandName="Update" id="UpdateButton" CausesValidation="True" /> <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" id="UpdateCancelButton" CausesValidation="False" /> </br></br> </EditItemTemplate> <InsertItemTemplate> Customer: <asp:TextBox Text='<%# Bind("Customer") %>' runat="server" id="CustomerTextBox" /> <br /> Forwarder: <asp:TextBox Text='<%# Bind("Forwarder") %>' runat="server" id="ForwarderTextBox" /> <br /> CargoTyp: <asp:TextBox Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypTextBox" /> <br /> ContTyp: <asp:TextBox Text='<%# Bind("ContTyp") %>' runat="server" id="ContTypTextBox" /> <br /> Quantity: <asp:TextBox Text='<%# Bind("Quantity") %>' runat="server" id="QuantityTextBox" /> <br /> ContNums: <asp:TextBox Text='<%# Bind("ContNums") %>' runat="server" id="ContNumsTextBox" /> <br /> Operation: <asp:TextBox Text='<%# Bind("Operation") %>' runat="server" id="OperationTextBox" /> <br /> Contractor: <asp:TextBox Text='<%# Bind("Contractor") %>' runat="server" id="ContractorTextBox" /> <br /> Voyage: <asp:TextBox Text='<%# Bind("Voyage") %>' runat="server" id="VoyageTextBox" /> <br /> Destination: <asp:TextBox Text='<%# Bind("Destination") %>' runat="server" id="DestinationTextBox" /> <br /> TDate: <asp:TextBox Text='<%# Bind("TDate") %>' runat="server" id="TDateTextBox" /> <br /> CostItem_1: <asp:TextBox Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1TextBox" /> <br /> CostItem_2: <asp:TextBox Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2TextBox" /> <br /> CostItem_3: <asp:TextBox Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3TextBox" /> <br /> CostItem_4: <asp:TextBox Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4TextBox" /> <br /> CostItem_5: <asp:TextBox Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5TextBox" /> <br /> CostItem_6: <asp:TextBox Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6TextBox" /> <br /> CostItem_7: <asp:TextBox Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7TextBox" /> <br /> CostItem_8: <asp:TextBox Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8TextBox" /> <br /> CostItem_9: <asp:TextBox Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9TextBox" /> <br /> Cost_Contranctor: <asp:TextBox Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorTextBox" /> <br /> Cost_Customer: <asp:TextBox Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerTextBox" /> <br /> Status: <asp:TextBox Text='<%# Bind("Status") %>' runat="server" id="StatusTextBox" /> <br /> <asp:LinkButton runat="server" Text="Insert" CommandName="Insert" id="InsertButton" CausesValidation="True" /> <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" id="InsertCancelButton" CausesValidation="False" /> </InsertItemTemplate> <ItemTemplate> T_id: <asp:Label Text='<%# Eval("T_id") %>' runat="server" id="T_idLabel" /> <br /> Customer: <asp:Label Text='<%# Bind("Customer") %>' runat="server" id="CustomerLabel" /> <br /> Forwarder: <asp:Label Text='<%# Bind("Forwarder") %>' runat="server" id="ForwarderLabel" /> <br /> CargoTyp: <asp:Label Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypLabel" /> <br /> ContTyp: <asp:Label Text='<%# Bind("ContTyp") %>' runat="server" id="ContTypLabel" /> <br /> Quantity: <asp:Label Text='<%# Bind("Quantity") %>' runat="server" id="QuantityLabel" /> <br /> ContNums: <asp:Label Text='<%# Bind("ContNums") %>' runat="server" id="ContNumsLabel" /> <br /> Operation: <asp:Label Text='<%# Bind("Operation") %>' runat="server" id="OperationLabel" /> <br /> Contractor: <asp:Label Text='<%# Bind("Contractor") %>' runat="server" id="ContractorLabel" /> <br /> Voyage: <asp:Label Text='<%# Bind("Voyage") %>' runat="server" id="VoyageLabel" /> <br /> Destination: <asp:Label Text='<%# Bind("Destination") %>' runat="server" id="DestinationLabel" /> <br /> TDate: <asp:Label Text='<%# Bind("TDate") %>' runat="server" id="TDateLabel" /> <br /> CostItem_1: <asp:Label Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1Label" /> <br /> CostItem_2: <asp:Label Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2Label" /> <br /> CostItem_3: <asp:Label Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3Label" /> <br /> CostItem_4: <asp:Label Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4Label" /> <br /> CostItem_5: <asp:Label Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5Label" /> <br /> CostItem_6: <asp:Label Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6Label" /> <br /> CostItem_7: <asp:Label Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7Label" /> <br /> CostItem_8: <asp:Label Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8Label" /> <br /> CostItem_9: <asp:Label Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9Label" /> <br /> Cost_Contranctor: <asp:Label Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorLabel" /> <br /> Cost_Customer: <asp:Label Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerLabel" /> <br /> Status: <asp:Label Text='<%# Bind("Status") %>' runat="server" id="StatusLabel" /> <br /> <asp:LinkButton runat="server" Text="Edit" CommandName="Edit" id="EditButton" CausesValidation="False" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" id="DeleteButton" CausesValidation="False" /> <asp:LinkButton runat="server" Text="New" CommandName="New" id="NewButton" CausesValidation="False" /> </ItemTemplate> </asp:FormView> <br> </td> </tr> </table> <p> </p> <p></p> </asp:Content>basheerkal
Star
10672 Points
2426 Posts
Re: ASP.Net FromView
Apr 08, 2012 02:47 PM|LINK
Your intention/problem is not clear. Please explain.
(Talk less..Work more)
Ahmed Elbend...
0 Points
5 Posts
Re: ASP.Net FromView
Apr 09, 2012 08:25 AM|LINK
basheerkal
Star
10672 Points
2426 Posts
Re: ASP.Net FromView
Apr 09, 2012 04:00 PM|LINK
Ok then try to find out something from this basic code
Code behind
protected void btnCalculate_Click(object sender, EventArgs e) { decimal qty = Convert.ToDecimal(txtQty.Text); decimal price = Convert.ToDecimal(txtPrice.Text); decimal amount = qty * price; amountLabel.Text = amount.ToString(); }In aspx
<asp:TextBox ID="txtQty" runat="server" Text= "156"></asp:TextBox> <asp:TextBox ID="txtPrice" runat="server" Text="12"></asp:TextBox> <asp:Button ID="btnCalculate" runat="server" onclick="btnCalculate_Click" Text="Calculate" /> <br /> <br /> <asp:Label ID="amountLabel" runat="server" Text="Label"></asp:Label>(Talk less..Work more)
Ahmed Elbend...
0 Points
5 Posts
Re: ASP.Net FromView
Apr 18, 2012 01:39 PM|LINK
I tried this code but I received this error: ''CS0103: The name 'Quantity TextBox' does not exist in the current context ''
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { decimal Quantity = Convert.ToDecimal(QuantityTextBox.Text); decimal CostItem_1 = Convert.ToDecimal(CostItem_1TextBox.Text); decimal amount = Quantity * CostItem_1; Cost_CustomerLabel.Text = amount.ToString(); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:SqlDataSource runat="server" id="Customer" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [C_id], [Cust_nam] FROM [Trans_Customer] order by [Cust_nam]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="Forwarder" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [C_id], [Cust_nam] FROM [Trans_Customer] where [cust_typ] = 'Forwarder' order by [Cust_nam]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="City" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=MAADI04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="Select distinct City from trans_price"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="contractor" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=maadi04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT distinct[Contractor] FROM [Trans_Price]"> </asp:SqlDataSource> <asp:SqlDataSource runat="server" id="operation" ProviderName="System.Data.SqlClient" ConnectionString="Data Source=MAADI04;Initial Catalog=Visitors;Persist Security Info=True;User ID=sa;Password=sa" SelectCommand="SELECT [T_id], [Customer], [Forwarder], [CargoTyp], [ContTyp], [Quantity], [ContNums], [Operation], [Contractor], [Voyage], [Destination], [TDate], [CostItem_1], [CostItem_2], [CostItem_3], [CostItem_4], [CostItem_5], [CostItem_6], [CostItem_7], [CostItem_8], [CostItem_9], [Cost_Contranctor], [Cost_Customer], [Status] FROM [Trans_Order] WHERE ([T_id] = @T_id)" DeleteCommand="DELETE FROM [Trans_Order] WHERE [T_id] = @T_id" InsertCommand="INSERT INTO [Trans_Order] ([Customer], [Forwarder], [CargoTyp], [ContTyp], [Quantity], [ContNums], [Operation], [Contractor], [Voyage], [Destination], [TDate], [CostItem_1], [CostItem_2], [CostItem_3], [CostItem_4], [CostItem_5], [CostItem_6], [CostItem_7], [CostItem_8], [CostItem_9], [Cost_Contranctor], [Cost_Customer], [Status]) VALUES (@Customer, @Forwarder, @CargoTyp, @ContTyp, @Quantity, @ContNums, @Operation, @Contractor, @Voyage, @Destination, @TDate, @CostItem_1, @CostItem_2, @CostItem_3, @CostItem_4, @CostItem_5, @CostItem_6, @CostItem_7, @CostItem_8, @CostItem_9, @Cost_Contranctor, @Cost_Customer, @Status)" UpdateCommand="UPDATE [Trans_Order] SET [Customer] = @Customer, [Forwarder] = @Forwarder, [CargoTyp] = @CargoTyp, [ContTyp] = @ContTyp, [Quantity] = @Quantity, [Operation] = @Operation, [Contractor] = @Contractor, [Destination] = @Destination, [TDate] = @TDate, [CostItem_1] = @CostItem_1, [CostItem_2] = @CostItem_2, [CostItem_3] = @CostItem_3, [CostItem_4] = @CostItem_4, [CostItem_5] = @CostItem_5, [CostItem_6] = @CostItem_6, [CostItem_7] = @CostItem_7, [CostItem_8] = @CostItem_8, [CostItem_9] = @CostItem_9, [Cost_Contranctor] = @Cost_Contranctor, [Cost_Customer] = @Cost_Customer, [Status] = @Status WHERE [T_id] = @T_id"> <SelectParameters> <asp:controlparameter ControlID="TextBox1" PropertyName="Text" Name="T_id" Type="Int32" /> </SelectParameters> <DeleteParameters> <asp:parameter Name="T_id" Type="Int32" /> </DeleteParameters> <UpdateParameters> <asp:parameter Name="Customer" Type="String" /> <asp:parameter Name="Forwarder" Type="String" /> <asp:parameter Name="CargoTyp" Type="String" /> <asp:parameter Name="ContTyp" Type="String" /> <asp:parameter Name="Quantity" Type="Decimal" /> <asp:parameter Name="Operation" Type="String" /> <asp:parameter Name="Contractor" Type="String" /> <asp:parameter Name="Destination" Type="String" /> <asp:parameter Name="TDate" Type="DateTime" /> <asp:parameter Name="CostItem_1" Type="Decimal" /> <asp:parameter Name="CostItem_2" Type="Decimal" /> <asp:parameter Name="CostItem_3" Type="Decimal" /> <asp:parameter Name="CostItem_4" Type="Decimal" /> <asp:parameter Name="CostItem_5" Type="Decimal" /> <asp:parameter Name="CostItem_6" Type="Decimal" /> <asp:parameter Name="CostItem_7" Type="Decimal" /> <asp:parameter Name="CostItem_8" Type="Decimal" /> <asp:parameter Name="CostItem_9" Type="Decimal" /> <asp:parameter Name="Cost_Contranctor" Type="Decimal" /> <asp:parameter Name="Cost_Customer" Type="Decimal" /> <asp:parameter Name="Status" Type="String" /> <asp:parameter Name="T_id" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:parameter Name="Customer" Type="String" /> <asp:parameter Name="Forwarder" Type="String" /> <asp:parameter Name="CargoTyp" Type="String" /> <asp:parameter Name="ContTyp" Type="String" /> <asp:parameter Name="Quantity" Type="Decimal" /> <asp:parameter Name="ContNums" Type="String" /> <asp:parameter Name="Operation" Type="String" /> <asp:parameter Name="Contractor" Type="String" /> <asp:parameter Name="Voyage" Type="Int32" /> <asp:parameter Name="Destination" Type="String" /> <asp:parameter Name="TDate" Type="DateTime" /> <asp:parameter Name="CostItem_1" Type="Decimal" /> <asp:parameter Name="CostItem_2" Type="Decimal" /> <asp:parameter Name="CostItem_3" Type="Decimal" /> <asp:parameter Name="CostItem_4" Type="Decimal" /> <asp:parameter Name="CostItem_5" Type="Decimal" /> <asp:parameter Name="CostItem_6" Type="Decimal" /> <asp:parameter Name="CostItem_7" Type="Decimal" /> <asp:parameter Name="CostItem_8" Type="Decimal" /> <asp:parameter Name="CostItem_9" Type="Decimal" /> <asp:parameter Name="Cost_Contranctor" Type="Decimal" /> <asp:parameter Name="Cost_Customer" Type="Decimal" /> <asp:parameter Name="Status" Type="String" /> </InsertParameters> </asp:SqlDataSource> </p> <table style="width: 100%"> <tr> <td class="style1"> Please Insert the Order Number and Press Enter Key <asp:TextBox runat="server" id="TextBox1" AutoPostBack="True"> </asp:TextBox> </td> </tr> <tr> <td class="style1"> </td> </tr> <tr> <td class="style1"> <p> <asp:FormView runat="server" id="FormView1" DataSourceID="operation" DataKeyNames="T_id" DefaultMode="Edit" Width="924px"> <EditItemTemplate> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td> </td> <td> </td> </tr> <tr> <td>Customer</td> <td>Forwarder</td> </tr> <tr> <td> <asp:DropDownList Text='<%# Bind("Customer") %>' runat="server" id="DDL_customer" DataSourceID="customer" AppendDataBoundItems="True" DataValueField="cust_nam" DataTextField="cust_nam" Font-Size="X-Small" Width="100%"> <asp:ListItem>Select..</asp:ListItem> </asp:DropDownList> </td> <td> <asp:DropDownList Text='<%# Bind("Forwarder") %>' runat="server" id="DDL_Forwarder" DataSourceID="Forwarder" AppendDataBoundItems="True" DataValueField="cust_nam" DataTextField="cust_nam" Font-Size="X-Small" Width="100%"> <asp:ListItem>Select..</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td>Date</td> <td> <asp:TextBox Text='<%# Bind("Tdate") %>' runat="server" id="TDateTextBox" /> </td> <td> </td> <td> </td> <td>Status</td> <td> <asp:DropDownList Text='<%# Bind("Status") %>' runat="server" id="DDL_status" Font-Size="X-Small" Width="219px"> <asp:ListItem Value="">Select..</asp:ListItem> <asp:ListItem>Pinding</asp:ListItem> <asp:ListItem>Collected</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Cargo Type</td> <td> <asp:TextBox Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypTextBox" readonly="true" /> </td> <td>Container Type</td> <td> <asp:DropDownList Text='<%# Bind("ContTyp") %>' runat="server" id="DDL_cont_typ" Font-Size="X-Small" Width="128px"> <asp:ListItem>Select..</asp:ListItem> <asp:ListItem>20 Feet</asp:ListItem> <asp:ListItem>40 Feet</asp:ListItem> <asp:ListItem>Reefer</asp:ListItem> </asp:DropDownList> </td> <td>Quantity</td> <td> <asp:TextBox Text='<%# Bind("Quantity") %>' runat="server" id="QuantityTextBox" /> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Operation</td> <td> <asp:DropDownList Text='<%# Bind("Operation") %>' runat="server" id="DDL_operation" Font-Size="X-Small" Width="219px"> <asp:ListItem>Select..</asp:ListItem> <asp:ListItem>Release and Transport</asp:ListItem> <asp:ListItem>Release Only</asp:ListItem> </asp:DropDownList> </td> <td>Contractor</td> <td> <asp:DropDownList Text='<%# Bind("Contractor") %>' runat="server" id="DDL_contractor" DataSourceID="Contractor" AppendDataBoundItems="True" DataValueField="Contractor" DataTextField="Contractor" Font-Size="X-Small" Width="125px"> <asp:ListItem Value="">Select..</asp:ListItem> </asp:DropDownList> </td> <td>Destination</td> <td> <asp:DropDownList Text='<%# Bind("Destination") %>' runat="server" id="DDL_city" DataSourceID="city" AppendDataBoundItems="True" DataValueField="city" DataTextField="city" Font-Size="X-Small" Width="128px"> <asp:ListItem Value="">Select..</asp:ListItem> </asp:DropDownList> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td class="style1" style="width: 301px">1</td> <td> <asp:TextBox Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">2</td> <td> <asp:TextBox Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">3</td> <td> <asp:TextBox Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">4</td> <td> <asp:TextBox Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">5</td> <td> <asp:TextBox Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">6</td> <td> <asp:TextBox Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">7</td> <td> <asp:TextBox Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">8</td> <td> <asp:TextBox Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8TextBox" /> </td> </tr> <tr> <td class="style1" style="width: 301px">9</td> <td> <asp:TextBox Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9TextBox" /> </td> </tr> </table> <table style="width: 100%" bgcolor="#D6E8FF"> <tr> <td> </td> <td> </td> <td> </td> <td> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Calculate" /> </td> </tr> <tr> <td>Contractor Cost</td> <td> <asp:TextBox Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorTextBox" /> </td> <td>Customer Cost</td> <td> <asp:Label Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerLabel" /> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> Please Remember to Check the Status<br> <br> <br /> <br /> <asp:LinkButton runat="server" Text="Update" CommandName="Update" id="UpdateButton" CausesValidation="True" /> <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" id="UpdateCancelButton" CausesValidation="False" /> <br></br> <br></br> <br></br> <br></br> </br></br> </EditItemTemplate> <InsertItemTemplate> Customer: <asp:TextBox Text='<%# Bind("Customer") %>' runat="server" id="CustomerTextBox" /> <br /> Forwarder: <asp:TextBox Text='<%# Bind("Forwarder") %>' runat="server" id="ForwarderTextBox" /> <br /> CargoTyp: <asp:TextBox Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypTextBox" /> <br /> ContTyp: <asp:TextBox Text='<%# Bind("ContTyp") %>' runat="server" id="ContTypTextBox" /> <br /> Quantity: <asp:TextBox Text='<%# Bind("Quantity") %>' runat="server" id="QuantityTextBox" /> <br /> ContNums: <asp:TextBox Text='<%# Bind("ContNums") %>' runat="server" id="ContNumsTextBox" /> <br /> Operation: <asp:TextBox Text='<%# Bind("Operation") %>' runat="server" id="OperationTextBox" /> <br /> Contractor: <asp:TextBox Text='<%# Bind("Contractor") %>' runat="server" id="ContractorTextBox" /> <br /> Voyage: <asp:TextBox Text='<%# Bind("Voyage") %>' runat="server" id="VoyageTextBox" /> <br /> Destination: <asp:TextBox Text='<%# Bind("Destination") %>' runat="server" id="DestinationTextBox" /> <br /> TDate: <asp:TextBox Text='<%# Bind("TDate") %>' runat="server" id="TDateTextBox" /> <br /> CostItem_1: <asp:TextBox Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1TextBox" /> <br /> CostItem_2: <asp:TextBox Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2TextBox" /> <br /> CostItem_3: <asp:TextBox Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3TextBox" /> <br /> CostItem_4: <asp:TextBox Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4TextBox" /> <br /> CostItem_5: <asp:TextBox Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5TextBox" /> <br /> CostItem_6: <asp:TextBox Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6TextBox" /> <br /> CostItem_7: <asp:TextBox Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7TextBox" /> <br /> CostItem_8: <asp:TextBox Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8TextBox" /> <br /> CostItem_9: <asp:TextBox Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9TextBox" /> <br /> Cost_Contranctor: <asp:TextBox Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorTextBox" /> <br /> Cost_Customer: <asp:TextBox Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerTextBox" /> <br /> Status: <asp:TextBox Text='<%# Bind("Status") %>' runat="server" id="StatusTextBox" /> <br /> <asp:LinkButton runat="server" Text="Insert" CommandName="Insert" id="InsertButton" CausesValidation="True" /> <asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" id="InsertCancelButton" CausesValidation="False" /> </InsertItemTemplate> <ItemTemplate> T_id: <asp:Label Text='<%# Eval("T_id") %>' runat="server" id="T_idLabel" /> <br /> Customer: <asp:Label Text='<%# Bind("Customer") %>' runat="server" id="CustomerLabel" /> <br /> Forwarder: <asp:Label Text='<%# Bind("Forwarder") %>' runat="server" id="ForwarderLabel" /> <br /> CargoTyp: <asp:Label Text='<%# Bind("CargoTyp") %>' runat="server" id="CargoTypLabel" /> <br /> ContTyp: <asp:Label Text='<%# Bind("ContTyp") %>' runat="server" id="ContTypLabel" /> <br /> Quantity: <asp:Label Text='<%# Bind("Quantity") %>' runat="server" id="QuantityLabel" /> <br /> ContNums: <asp:Label Text='<%# Bind("ContNums") %>' runat="server" id="ContNumsLabel" /> <br /> Operation: <asp:Label Text='<%# Bind("Operation") %>' runat="server" id="OperationLabel" /> <br /> Contractor: <asp:Label Text='<%# Bind("Contractor") %>' runat="server" id="ContractorLabel" /> <br /> Voyage: <asp:Label Text='<%# Bind("Voyage") %>' runat="server" id="VoyageLabel" /> <br /> Destination: <asp:Label Text='<%# Bind("Destination") %>' runat="server" id="DestinationLabel" /> <br /> TDate: <asp:Label Text='<%# Bind("TDate") %>' runat="server" id="TDateLabel" /> <br /> CostItem_1: <asp:Label Text='<%# Bind("CostItem_1") %>' runat="server" id="CostItem_1Label" /> <br /> CostItem_2: <asp:Label Text='<%# Bind("CostItem_2") %>' runat="server" id="CostItem_2Label" /> <br /> CostItem_3: <asp:Label Text='<%# Bind("CostItem_3") %>' runat="server" id="CostItem_3Label" /> <br /> CostItem_4: <asp:Label Text='<%# Bind("CostItem_4") %>' runat="server" id="CostItem_4Label" /> <br /> CostItem_5: <asp:Label Text='<%# Bind("CostItem_5") %>' runat="server" id="CostItem_5Label" /> <br /> CostItem_6: <asp:Label Text='<%# Bind("CostItem_6") %>' runat="server" id="CostItem_6Label" /> <br /> CostItem_7: <asp:Label Text='<%# Bind("CostItem_7") %>' runat="server" id="CostItem_7Label" /> <br /> CostItem_8: <asp:Label Text='<%# Bind("CostItem_8") %>' runat="server" id="CostItem_8Label" /> <br /> CostItem_9: <asp:Label Text='<%# Bind("CostItem_9") %>' runat="server" id="CostItem_9Label" /> <br /> Cost_Contranctor: <asp:Label Text='<%# Bind("Cost_Contranctor") %>' runat="server" id="Cost_ContranctorLabel" /> <br /> Cost_Customer: <asp:Label Text='<%# Bind("Cost_Customer") %>' runat="server" id="Cost_CustomerLabel" /> <br /> Status: <asp:Label Text='<%# Bind("Status") %>' runat="server" id="StatusLabel" /> <br /> <asp:LinkButton runat="server" Text="Edit" CommandName="Edit" id="EditButton" CausesValidation="False" /> <asp:LinkButton runat="server" Text="Delete" CommandName="Delete" id="DeleteButton" CausesValidation="False" /> <asp:LinkButton runat="server" Text="New" CommandName="New" id="NewButton" CausesValidation="False" /> </ItemTemplate> </asp:FormView> <br> </td> </tr> </table> <p> </p> <p></p> </asp:Content> </div> </form> </body> </html>superguppie
All-Star
48225 Points
8679 Posts
Re: ASP.Net FromView
Apr 20, 2012 11:46 AM|LINK
That looks like something from code-behind. You didn't post any.
Note: IDs can not have spaces in them. (Or is that just from copying the message?)
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
When all you've got is a Hammer, Every Problem looks like a Nail. Michael Swain.