Updating to a database from a detailsview template field

That means that all fields will be generated at run time, depending of what fields your data source contains.

This is fast solution, but if you want more control over the way how fields will be presented, you need to set Auto Generate Rows property to False. Details View control has seven types of fields, every with different purpose: Bound Field - This is default field, used when Auto Generate Rows is true.

Run the example and Details View control will show first record, similar to the next image: Before using an example you need to set Data Key Names property of Details View control to the name of table primary key column.

In our case table primary key column is named "Product ID".

Here is a markup code for this Sql Data Source control: ="SELECT Products. Of course, you can use your own existing table, just adopt Sql Data Source commands to suit your table structure.

Category Name FROM Products INNER JOIN Categories ON Products. ID ORDER BY Product ID" This data source contains commands for all four basic operations: Select, Update, Insert and Delete.

You'll see new buttons Edit, Delete and New link buttons.

In this article I will show you that how you can use SQLData Source control to insert, update and delete in the Details View control.You can use it for simple text data type Button Field - Showing a Button control Check Box Field - Showing a Check Box control, used for boolean yes/no fields Command Field - Command buttons, like Edit, Delete or New, used for manipulating data Hyper Link Field - Used to show a hyperlink Image Field - Used to show an image Template Field - Used to show data in custom layout, when other field types are inadequate Implemented in our example, markup code with custom fields used could look like this: Category selection uses data from second table.To bind categories to Drop Down List control we need to add another data source control.As you can see in the code above I have declared three Template Columns inside the Details View control and assigned its Text property to the fields in the database.This will display the data in the Details View control.

Search for updating to a database from a detailsview template field:

updating to a database from a detailsview template field-55updating to a database from a detailsview template field-72

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “updating to a database from a detailsview template field”