DataGrid (Grid view) Interview Preparation Guide
Download PDF

DataGrid (Grid view) Interview Questions and Answers will guide us that DataGrid is a graphical user interface element just like widget that presents a tabular view of data. A typical grid view also supports , Clicking a column header to change the sort order, Dragging column headers to change their size and their order, In-place editing of viewed data, Row and column separators, and alternating row background colors, learn more about DataGrid with this DataGrid Interview Questions Answers Guide

28 DataGrid (Grid view) Questions and Answers:

1 :: What is a DataGrid or Grid View?

The DataGrid Web server control is a powerful tool for displaying information from a data source. It is easy to use; you can display editable data in a professional-looking grid by setting only a few properties. At the same time, the grid has a sophisticated object model that provides you with great flexibility in how you display the data.

2 :: What is the difference between the System.Web.UI.WebControls.DataGrid and and System.Windows.Forms.DataGrid?

The Web UI control does not inherently support master-detail data structures. As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself. You can only edit one row at a time. It does not inherently support sorting, although it raises events you can handle in order to sort the grid contents. You can bind the Web Forms DataGrid to any object that supports the IEnumerable interface. The Web Forms DataGrid control supports paging. It is easy to customize the appearance and layout of the Web Forms DataGrid control as compared to the Windows Forms one.

3 :: 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.

4 :: Why can not I edit the results of a query in the SQL Editor?

Query statements MUST return the ROWID to be updatable. For example:

select * from employee where salary > 2000

would not be updatable, whereas:

select employee.*, rowid from employee where salary > 2000

would be updatable.

To reduce this obvious nuisance, you can use the TOAD-specific EDIT statement. For example:

edit employee where salary > 2000

If the resultset should be editable but remains read-only, make sure the TOAD Options > Data Grids - Data tab, Default to Read-Only Queries checkbox is NOT enabled

5 :: Why can not I add a new record by hitting the down arrow key in the data tab?

Please upgrade your copy of TOAD to at least version 7.4.0.3. This functionality has been restored.

6 :: What is the OCI Buffer Array Size option for in the View - Options - Oracle - General section?

After a SELECT query is executed, we must retrieve the rows from the Oracle server to your PC. We do not retrieve the rows all at once, nor do we retrieve them one at a time (unless there is a LONG or LOB column involved). We retrieve the rows in blocks. The number of rows retrieved in each block is the number of rows you specify with "OCI Array Buffer Size". TOAD defaults to 25 because SQL*Plus defaults to 25. In my opinion, an optimal setting is more like 500 or 1000. Here is why: If your dataset has 1,000 rows, and your OCI Array Buffer size is set to 25, then TOAD has to make 40 (that's 1000 / 25) round trips across the network to retrieve all of the rows. So you can immediately see why 500 or 1000 is better. The only disadvantage to a higher setting of OCI Array Buffer Size is that TOAD must allocate memory to hold that many rows prior to each fetch. If that many rows are actually fetched, there is no loss. On the other hand, if not that many rows are retrieved, then we allocated some memory that is not going to be released until the cursor is freed. Luckily, this is a trivial amout of memory, in the grand scheme of things.

7 :: What is the Clone Cursor Options for on the SaveAs dialogs in the Schema Browser and (SQL) Editor?

When "Clone Cursor" is turned OFF, and a user goes to the "save as" screen and begins an export, we use the actual cursor which is tied to the data grid. The advantage to this is that the query does not need to be re-executed. The disadvantage to this is that the whole dataset must be held in your PC's RAM, because this is a scrollable dataset (it is this mechanism that allows scrolling in the grids). When "Clone Cursor" is turned ON, and a user goes to the "save as" screen and begins an export, we create a new, non-scrollable cursor. The advantage here is that as rows are read in and sent to the destination file, we don't have to hold them in memory any longer...and a minimal amout of RAM is used. The disadvantage is that for this to happen, the query must be re-executed. So...which setting should you use? If your query returns a LOT of rows (too many to hold in your PC's RAM), you should have "Clone Cursor" turned ON...even if your query takes a long time to execute. If your query returns a number of rows such that the entire dataset will easily fit into your PC's memory, then we should consider the execution time for the query. If execution time is slow, then leave "Clone Cursor" OFF. If execution time is fast, then it doesn't really matter.

This option has been renamed to "Display all exported results in grid" for version 9.1. It will be greyed out if the dataset being exported has already been completely fetched, e.g. OCI Array = 500 and only 125 records, or you have already scolled to the bottom of the result set. If either of these cases are not true, then if this option IS set, Toad will execute the statement again and fetch ALL of the rows for the export, and then also send the entire result set to the original data grid so you can see them there too after the export has finished.

8 :: Explain My string data is all coming out as question marks?

We have found that this happens when the database character set is WE8ISO8859P1, and the Oracle client is 9.2.0.1. This is an Oracle bug, and upgrading your client to 9.2.0.4 or higher should resolve the problem. In any other case, please generate a TOAD Support Bundle from the Help menu and let us know what you are seeing.

9 :: How do I delete a record?

Assuming that the result set is editable (i.e. you have written a query that includes the ROWID, or you have used the TOAD Edit command), you can do one of the following:

*
"Delete row" button on the SQL Editor toolbar
*
CTRL+Del
*
Single Record View, Delete Button

10 :: How can I see the data in nested tables?

TOAD 7.5 and up can show nested table data in popups from the data grids if you are using an 8.0 or higher Oracle client. The nested table data will appear in the grid cell as "(DATASET)". Right-click over this cell and choose "Popup editor". TOAD 9.0.1 now supports nested table data in its "run as script" function. TOAD versions 7.4 and previous do not support nested table data due to a limitation in their data layer.