![]() Summarize data from various tables, which can be used to generate reports. Restrict access to the data such that a user can only see limited data instead of a complete table. Structure data in a way that users or classes of users find natural or intuitive. Views which are kind of virtual tables, allow the users to − A view can be created from one or many tables which depends on the written SQLite query to create a view. It is actually a composition of a table in the form of a predefined SQLite query.Ī view can contain all rows of a table or selected rows from one or more tables. To do that we need a RowEditing event of the GridView.A view is nothing more than a SQLite statement that is stored in the database with an associated name. So first we need to move to an updateable row record in the TextBox. We can't update a record until that record doesn't exist in the input type field (TextBox). Point numbers 2 and 3 are performed after point 1 is performed. Update record and get updated state of GridView.Īccording to the above, in these three operations we use three events of the GridView for each operation. To update a record in the GridView we need to perform the following three operations:Ĭancel edit operation and get original state without any update if (con.State = ConnectionState.Closed).cmd.CommandType = CommandType.StoredProcedure.SqlCommand cmd = new SqlCommand( "_sp_DeleteEmployee" , con).protected void gvEmployee_RowDeleting( object sender, GridViewDeleteEventArgs e).We define a connection in the web.config file and give a name to the connection string. We need a connection with a Microsoft SQL Server database so we can access data and perform an operation on it. Here we define the image type button so it can display an icon of the operation instead of their name. : It is a special field that displays command buttons to perform selecting, editing, inserting and deleting. This method is used when we will edit a row record otherwise we can use the Bind method. ![]() In this method we pass a database field name as an argument and that database field is displayed by this. : It also specifies contents that are displayed in a TemplateField but in EditMode.Įval: It is a method that is used to display data. It displays a layout for the TemplateField. : It specifies the contents that are displayed in a TemplateField object. It is useful when we are using a GridView to edit a database record. It customizes the appearance of the UI in the GridView. One TemplateField represents one column in the GridView. : Is used to add ASP.Net controls in GridView rows. By this we can control what GridView columns are displayed, which means we can change the order of the appearance of the columns. : It is a collection of columns that the GridView contains. Mostly it is a primary key field or unique field. Here we are using the "Id" field of the EMPLOYEE table that field does not display in the GridView but this field value is used to access the table by row and can perform updates/deletes depending on this field value because it is the EMPLOYEE table's primary key field. By this we uniquely identifiy records in GridView rows. When we assign more than one database column then they are specified separated by commas. Here we can assign the name of a single database column or more than one column. When we set it to True then all table fields are retrieved by the SQL query or Stored Procedure and also bound the with GridView and we get all field columns in the GridView with their records as well as manual records.ĭataKeyNames: This property associates a value with each row in the GridView. When we set it to False, the BoundField objects are not created automatically we will create the fields manually. The following bulleted list describes each field of the GridView used in the design of it:ĪutoGenerateColumns: This property accepts only a Boolean value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |