DataGrid (Grid view)

  Home  Microsoft .Net Technologies  DataGrid (Grid view)


“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⟩ 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

 148 views

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

 188 views

4⟩ 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.

 152 views

5⟩ 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.

 192 views

6⟩ 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

 147 views

7⟩ 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.

 184 views

8⟩ How can I see nested object data?

TOAD 7.5 and up can show nested object type data in popups from the data grids if you are using an 8.0 or higher Oracle client. Right-click on the cell that should contain the data and choose "Popup editor". TOAD 9.0.1 now supports nested object data in its "run as script" function. TOAD versions 7.4 and previous do not support nested object data due to a limitation in their data layer.

 163 views

9⟩ How can I see TIMESTAMP and INTERVAL data?

TOAD 7.5 and up can show TIMESTAMP and INTERVAL data in its data grids if you are using a 9.0.1 or higher Oracle client. TOAD 9.0.1 supports TIMESTAMP and INTERVAL data in its "run as script" function. TOAD versions 7.4 and previous do not support TIMESTAMP and INTERVAL data due to a limitation in their data layer.

To see timestamp/intervals in the "datatype" drop down in the Create/Alter Table window, and in the "Add Column" window, go to options → datatypes, and make sure "Include Timestamp/Interval Types" is checked.

 160 views

11⟩ Why does saving to XLS instance not work sometimes?

From the Toad lists.

One of my co-workers experiences a very strange problem. When he is saving the results of a query using "Save As" into Excel Instance nothing happens. There is 1 opened Excel and it stays empty. All other "save as" option work fine (including saving into Xls File). What could be the problem?

John Dorlon replied :

*

Close excel.

*

Look in task manager.

*

If you still see excel running, kill it.

It seems that Excel gets confused as to whether it is running once or not and the hidden instance of Excel is causing the problem as it is most likely receiving the saved data. (explanation courtesy of Norm and it might even be right! LOL)

How do I name the tabs when I run a script?

 137 views

12⟩ How do I name the tabs when I run a script?

When you run a script in the MOE using F5, the output of the script is displayed at the bottom of the screen. Each command creates a separate tab for its results, as well as being included in the main script output tab. These tabs are simply named 'Grid n' where n is an incrementing number starting at 1. If you run a script with 5 SELECT statements, you get 'Grid 1' though 'Grid 5'.

A question on the list from Roger Simoneau, asked how we could programatically rename the tabs from within the script. Both Erwin Rollauer and Ed Klinger (TeamT) supplied answers.

If you use the TTITLE directive before the SELECT statement, the tab will be named using the data from the TTITLE directive, as follows :

TTITLE today

SELECT sysdate FROM dual;

The tab for this statement will have the title 'today' exactly as entered.

If you need to use more than one word for the tab name, you must wrap the words in quotes, single ( ' ) or double ( " ) work equally as well.

TTITLE "today is roughly around ..."

SELECT sysdate FROM dual;

Try it and see. I wonder if TTITLE actually stands for 'Tab Title'? LOL.

 146 views

13⟩ How do I change the grid popup editor font?

Another one from the list. Herald asked > I changed the font for the DATA Grids, so I could look at Unicode. Now I see the chosen font in the datagrid, but if I open the popup editor it still gives the old font. Is it possible to change this font also, I didn't find it in the options, or could you make the grid popup editor font the same as the data grid font.

After much searching, Brad supplied the following obvious LOL solution :

*

Go to View → Toad Options → Editor → Behavior.

*

In the Languages section, select "Plain Text" from the dropdown and click the Edit ... button next to the dropdown.

*

Go to the Highlighting tab and click the "custom font" button.

*

Choose your font and OK your way out.

 149 views

14⟩ How do you display an editable drop-down list?

Displaying a drop-down list requires a template column in the grid. Typically, the ItemTemplate contains a control such as a data-bound Label control to show the current value of a field in the record. You then add a drop-down list to the EditItemTemplate. In Visual Studio, you can add a template column in the Property builder for the grid, and then use standard template editing to remove the default TextBox control from the EditItemTemplate and drag a DropDownList control into it instead. Alternatively, you can add the template column in HTML view. After you have created the template column with the drop-down list in it, there are two tasks. The first is to populate the list. The second is to preselect the appropriate item in the list — for example, if a book’s genre is set to “fiction,” when the drop-down list displays, you often want “fiction” to be preselected.

 183 views

15⟩ How do you hide the columns?

One way to have columns appear dynamically is to create them at design time, and then to hide or show them as needed. You can do this by setting a column’s Visible property.

 150 views

16⟩ How do you apply specific formatting to the data inside the cells?

You cannot specify formatting for columns generated when the grid’s AutoGenerateColumns property is set to true, only for bound or template columns. To format, set the column’s DataFormatString property to a string-formatting expression suitable for the data type of the data you are formatting.

 128 views

18⟩ What is asp.net?

ASP.NET is the latest version of Microsoft's Active Server Pages technology (ASP).

ASP.NET is a part of the Microsoft .NET framework, and a powerful tool for creating dynamic and interactive web pages

 140 views

19⟩ How to sort the data in Datagrid ? when we use DataBound event of Datagrid, I want to display te data using controls.... For an example, If i click a button, which is outside of the datagrid, entire data should be shown. 1st column in TextBoxs. second column in Drop down List Boxs.. How to bind the data in Dropdownlist,which is in DataGrid at run time? Row1 Row2 Row3 Row4 ----------------- This is the record in datagrid... When we click button (Bottom of the DataGrid), This Record should be shown... Row1 in TextBox,,, Row2 in TextBox, Row3 in DropDownlistbox, Row4 in TextBox... How to do this one? Which event we should use?

Sorting in DataGrid.Using the SortCommand Event in the datagrid u can sort the value in datagrid.For Example.Dim con as new oledb.oledbconnection("connectionstring")con.open()Dim sql as stringsql="query"Dim DataAdapter as new oledb.oledbdataadapter(sql,con)dim ds as new datasetdataadapter.fill(ds)Private Sub DGMain_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles DGMain.SortCommand Dim datasort As DataView datasort = LocalLibrary.GetDataSet(sql).Tables(0).DefaultView datasort.Sort = e.SortExpression DGMain.DataSource = datasort DGMain.DataBind() End SubBind the data in Datagrid at runtime ?Use ItemDataBound Event in datagrid.Private Sub DGMain_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DGMain.ItemDataBound If e.Item.ItemIndex > -1 Then Dim lblClose As dropdownlist lblClose = CType(e.Item.FindControl("lblClose"), dropdownlist) If Not lblClose Is Nothing Then lblclose.items.add("dropdownassignvalue")lblclose.items("dropdownindex").value="assigned value" End If End If End Sub

 176 views