+91 90691 39140 | +1 253 214 3115 | info@hub4tech.com | hub4tech

Datagrid Interview Questions and Answers

1
What is the purpose of using DataGrid control?
  • The DataGrid control is used to display the fields of the table. It is basically associated with the data source that is present in the column of a table.
  • DataGrid provides the access to the rows that allows the control to be taken to the record in the data source.
  • DataGrid control provides various features like editing, selection, deleting, paging and sorting.
  • DataGrid control allows the user to write the input to bring the output on the web front. It can contain the executable scripts or SQL statements.
  • DataGrid control uses the validation server control to validate the data rows and columns of the table.
2
How do you check whether the row data has been changed?

The definitive way to determine whether a row has been dirtied is to handle the changed event for the controls in a row. For example, if your grid row contains a TextBox control, you can respond to the control’s TextChanged event. Similarly, for check boxes, you can respond to a CheckedChanged event. In the handler for these events, you maintain a list of the rows to be updated. Generally, the best strategy is to track the primary keys of the affected rows. For example, you can maintain an ArrayList object that contains the primary keys of the rows to update.

3
What is Dataset object? Explain the various objects in Dataset.

The DataSet object is a disconnected storage.
It is used for manipulation of relational data.
The DataSet is filled with data from the store
We fill it with data fetched from the data store. Once the work is done with the dataset, connection is reestablished and the changes are reflected back into the store.

Dataset has a collection of Tables which has DataTable collection which further has DataRow DataColumn objects collections.
It also has collections for the primary keys, constraints, and default values called as constraint collection.
A DefaultView object for each table is used to create a DataView object based on the table, so that the data can be searched, filtered or otherwise manipulated while displaying the data.

4
In DataGrid, is it possible to add rows one by one at runtime. That means after entering data in one row next row will be added?

Yes, for this you have to use datatable and after inserting the first row in datatable u have to bind that datatable to the grid and next time , first u have to add the row in datatable and next bind it to datagrid. keep on doing.
u have to maintain the datatable state.

5
What are the different types of columns that exist in DataGrid?

The different column types used in DataGrid are as follows:

  • BoundColumn: this type is used to display the field in a data source. The field consists of an item in the form of text. This is the default column type in DataGrid control.
  • ButtonColumn: this type is used to display the column that consists of editing commands used in the column.
  • HyperLinkColumn: this type displays the content of item in the column as a hyperlink. The content can be in the form of a text or it can have an association with other fields.
  • TemplateColumn: this type displays the item according the template and it also allow the creation of custom controls for the templates.
Copyright ©2015 Hub4Tech.com, All Rights Reserved. Hub4Tech™ is registered trademark of Hub4tech Portal Services Pvt. Ltd.
All trademarks and logos appearing on this website are the property of their respective owners.
FOLLOW US