This document describes the release of ASP. NET MVC 3 RTM for Visual Studio 2010. ASP. NET MVC is a framework for developing Web applications that uses the ModelView. Field column and additionally I have added Command. Field column with Show. Edit. Button and Show. Delete. Button set to true so that the Grid. View displays Edit and Delete buttons respectively. Note If you do not want a particular field to be editable, simply set Read. Only property to True for the respective Bound. Field column in Grid. View. The Customer. Id field has been set to the Data. Key. Names property, it is very necessary as Sql. Data. Source uses Data. Key. Names value for Updating and Deleting records. Grid. View. IDGrid. View. Auto. Generate. ColumnsfalseData. Source. IDSql. Data. Source. 1 Data. Key. NamesCustomer. IdOn. Row. Data. BoundOn. Row. Data. BoundEmpty. Data. TextNo records has been added. Columns lt asp Bound. Field. Data. FieldNameHeader. TextNameItem. Style Width1. Bound. Field. Data. FieldCountryHeader. TextCountryItem. Style Width1. Command. Field. Button. TypeLinkShow. Edit. ButtontrueShow. Delete. Buttontrue Item. Style Width1. 00 lt Columns lt asp Grid. View lt tableborder1cellpadding0cellspacing0styleborder collapse collapse lt tr lt tdstylewidth 1. Name lt br lt asp Text. Box. IDtxt. NamerunatserverWidth1. Country lt br lt asp Text. Box. IDtxt. CountryrunatserverWidth1. Button. IDbtn. AddrunatserverTextAddOn. ClickInsert lt td lt tr lt table lt asp Sql. Data. Source. IDSql. Data. Source. 1runatserverConnection. Stringlt Connection. Strings constr Select. CommandSELECT Customer. Id, Name, Country FROM Customers Insert. CommandINSERT INTO Customers VALUES Name, Country Update. CommandUPDATE Customers SET Name Name, Country Country WHERE Customer. Id Customer. Id Delete. CommandDELETE FROM Customers WHERE Customer. Id Customer. Id lt Insert. Parameters lt asp Control. Parameter. NameNameControl. IDtxt. NameTypeString lt asp Control. Parameter. NameCountryControl. IDtxt. CountryTypeString lt Insert. Parameters lt Update. Parameters lt asp Parameter. NameCustomer. IdTypeInt. Parameter. NameNameTypeString lt asp Parameter. NameCountryTypeString lt Update. Parameters lt Delete. Parameters lt asp Parameter. NameCustomer. IdTypeInt. Delete. Parameters lt asp Sql. Data. Source Populating Grid. View from Database. Define and set the Connection String to the database in Web. Config file. lt connection. Strings lt add nameconstr connection. StringData Source. SQLExpress Initial CatalogSamples integrated securitytrue lt connection. Strings 2. Apply the Connection String to Sql. Data. Source. Here constr is the name of the Connection String setting in Web. Config file. Connection. Stringlt Connection. Strings constr 3. Set the ID of the Sql. Data. Source as Data. Source. ID for the Grid. View. Data. Source. IDSql. Data. Source. Set the Select Command. Select. CommandSELECT Customer. Id, Name, Country FROM CustomersFollowing is the Grid. View containing records. For the Grid. View I have set Empty. Data. Text to display message when no records are present. Inserting records to Grid. View using Sql. Data. Source. 1. Set the Insert. Command. Insert. CommandINSERT INTO Customers VALUES Name, Country2. Set the Insert Parameters. Since I need to get the values from the Text. Boxes in my form, I have made use of Control. Parameter and I have defined the ID of the control for its respective Control. Parameter. For example, the value of Name Parameter is fetched from txt. Name Text. Box. lt Insert. Parameters lt asp Control. Parameter. NameNameControl. IDtxt. NameTypeString lt asp Control. Parameter. NameCountryControl. Samsung Hard Drive Backup Software. IDtxt. CountryTypeString lt Insert. Parameters 3. Theres a Click event handler assigned to the Add Button. When the Button is clicked, the Insert function of the Sql. Data. Source is executed which then inserts the records to the database and binds the Grid. View again to display the newly inserted record. Cprotectedvoid Insertobject sender, Event. Args e Sql. Data. Source. 1. Insert VB. Net. Protected. Sub Insertsender As. Object, e As. Event. Args Sql. Data. Source. 1. InsertEnd. Sub. Editing and Updating Grid. View records using Sql. Data. Source. 1. Set the Update. Command. Here you simply need to set parameter names same as their corresponding column fields. For example if the column name is Name its corresponding parameter name will be Name. Once this is done the Sql. Data. Source will automatically pick values from respective Text. Boxes inside the Grid. View row to be edited. Update. CommandUPDATE Customers SET Name Name, Country Country WHERE Customer. Id Customer. Id2. Set the Update Parameters with name and data type. Update. Parameters lt asp Parameter. NameCustomer. IdTypeInt. Parameter. NameNameTypeString lt asp Parameter. NameCountryTypeString lt Update. Parameters Deleting Grid. View records using Sql. Data. Source. 1. Set the Delete. Command. Delete. CommandDELETE FROM Customers WHERE Customer. Id Customer. Id2. Set the Delete Parameters with name and data type. Here the Customer. Id field will automatically be picked from the Data. Key. Names property of the Grid. View row to be deleted. Delete. Parameters lt asp Parameter. NameCustomer. IdTypeInt. Delete. Parameters 3. In order to display a confirmation message when deleting row, I have made use of On. Row. Data. Bound event handler where I have first determined the Delete Button and then I have attach the Java. Script Confirm to its client side Click event handler. Cprotectedvoid On. Row. Data. Boundobject sender, Grid. View. Row. Event. Args e if e. Row. Row. Type Data. Control. Row. Type. Data. Row Grid. View. 1. Edit. Index e. Row. Row. Index e. Row. Cells2. Controls2 as. Link. Button. Attributesonclick return confirmDo you want to delete this row VB. Net. Protected. Sub On. Row. Data. Boundsender As. Object, e As. Grid. View. Row. Event. Args If e. Row. Row. Type Data. Control. Row. Type. Data. Row And. Also Grid. View. 1. Edit. Index lt e. Row. Row. Index Then Try. Caste. Row. Cells2. Controls2, Link. System. Component. Model. Data. Annotations Namespace. Defines a helper class that can be used to validate objects, properties, and methods when it is included in their associated Validation. Attribute attributes.