My formview datasource is a database table named "properties".
CREATE TABLE [dbo].[properties] (
[property_id] INT IDENTITY (1, 1) NOT NULL,
[property_type_code] INT NOT NULL,
[city_id] INT NULL,
[date_on_market] DATETIME NULL,
[property_name] CHAR (25) NULL,
[property_owner] CHAR (25) NULL,
[property_description] CHAR (100) NULL,
[property_address] CHAR (50) NULL,
[vendor_requested_price] INT NULL,
[other_property_details] CHAR (50) NULL,
CONSTRAINT [Key7] PRIMARY KEY CLUSTERED ([property_id] ASC),
CONSTRAINT [Relationship15] FOREIGN KEY ([property_type_code]) REFERENCES [dbo].[ref_properties_type] ([property_type_code]),
CONSTRAINT [Relationship56] FOREIGN KEY ([city_id]) REFERENCES [dbo].[cities] ([city_id]) ON DELETE CASCADE);
My Formview is like that :
`<asp:FormView ID="FormView1" runat="server" DataKeyNames="property_id" DataSourceID="SqlDataSource2" oniteminserted="FormView1_ItemInserted" oniteminserting="FormView1_ItemInserting">
<InsertItemTemplate>
property_type_code:
<asp:TextBox ID="property_type_codeTextBox" runat="server" Text='<%# Bind("property_type_code") %>' />
<br />
date_on_market:
<asp:TextBox ID="date_on_marketTextBox" runat="server" Text='<%# Bind("date_on_market") %>' />
<br />
property_name:
<asp:TextBox ID="property_nameTextBox" runat="server" Text='<%# Bind("property_name") %>' />
<br />
property_owner:
<asp:TextBox ID="property_ownerTextBox" runat="server" Text='<%# Bind("property_owner") %>' />
<br />
property_description:
<asp:TextBox ID="property_descriptionTextBox" runat="server" Text='<%# Bind("property_description") %>' />
<br />
property_address:
<asp:TextBox ID="property_addressTextBox" runat="server" Text='<%# Bind("property_address") %>' />
<br />
vendor_requested_price:
<asp:TextBox ID="vendor_requested_priceTextBox" runat="server" Text='<%# Bind("vendor_requested_price") %>' />
<br />
other_property_details:
<asp:TextBox ID="other_property_detailsTextBox" runat="server" Text='<%# Bind("other_property_details") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
<asp:Button ID="NewButton" runat="server" CausesValidation="False"
CommandName="New" Text="Add New" />
</ItemTemplate>
</asp:FormView>`
If you pay attention there is no fields for "property_id" and "city_id" in formview. (I deleted them) My question is that: How can I edit these two columns' values ("property_id" and "city_id") before inserting? Because for example; "city_id" need to be a specific value accordingly "querystring". I hope I explained my problem clearly.