QueryCAT Logo
Search 5,000,000+ questions and answers.

Frequently Asked Questions

How do I display text in the row header column of a DataGrid?

DataGrid - Windows Forms FAQs
There is no text property exposed for a rowheader cell. But you can handle the Paint event and draw header text yourself. You can download sample projects ( C# , VB ) that illustrate one technique for doing so. The sample loads the DataGrid in the form's... Set the DataGrid.AllowNavigation property to false. Contributed from George Shepherd's Windows Forms FAQ

How do I get a DataGrid's column header text in a MouseUp event?

DataGrid - Windows Forms FAQs
using System; using System.Data; using System.Drawing; using System.Windows.Forms; // ... private void dataGrid1_MouseUp(object sender, MouseEventArgs e) { Point point = new Point( e.X, e.Y ); DataGrid.HitTestInfo hti = dataGrid1.HitTest( point ); if...

Can I delete or change the column Header icons? Can I change the Text?

Manual & FAQ
The icons are individual graphics that you can delete or replace with graphics of your own. Delete an icon by selecting it with the mouse then pressing the "delete" key on your keyboard. Refer to the screen shots at the right. Insert a new icon using the "Insert Photo" button from the XL Pro Command Bar or from the XL Pro drop-down menu. All standard photo and graphics formats are handled by all XL Pro editions.

How do I move rows in a DataGrid by dragging the row header cell?

DataGrid - Windows Forms FAQs
One way to implement this is to derive a DataGrid and override the virtual OnMouseDown, OnMouseMove and OnMouseUp methods. In your overrides, if the mousedown is on a row header, track the initial mousedown row, and as it moves, draw a line to indicate...

How do I determine the row and column of the current cell in a DataGrid?

DataGrid - Windows Forms FAQs
You can use the CurrentCell property of the DataGrid. private void button1_Click(object sender, System.EventArgs e) { int colNum = dataGrid1.CurrentCell.ColumnNumber; int rowNum = dataGrid1.CurrentCell.RowNumber; object cellValue = dataGrid1[rowNum, colNum...

How do I determine the row or column of a DataGrid that has been clicked on?

DataGrid - Windows Forms FAQs
You can use the DataGrid's HitTest method, passing it a point in the grid's client coordinate system, and returning a HitTestInfo object that holds all the row and column information that you want. X & Y are in the grid' coordinates. If...

How do I change the width of the row or column headers in a DataGrid or hide them completely?

DataGrid - Windows Forms FAQs
You can get at the width and visibility of the header row/column through a DataGridTableStyle. DataGridTableStyle has properties such as RowHeadersVisible and RowHeadersWidth. DataGridTableStyle also controls things like selections colors and GridLine...

How do I display a column of Buttons or ComboBox buttons in a DataGrid?

DataGrid - Windows Forms FAQs
This sample ( download C# , download VB ) derives two custom columnstyles that display buttons. One displays a pushbutton with the cell text used as the button label. The second columnstyle displays text plus a dropdown button similar to a combobox button...

How to display the total of a particular column at the footer of the DataGrid?

Datagrid Web Control in Asp.net , Problems, Issues and FAQs ...
lt;asp:DataGrid id="DataGrid1" OnItemDataBound="ItemDB" ShowFooter =true runat="server"></asp:DataGrid> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load The wrap functionality occurs for each cell and not for each row of the DataGrid. Therefore, if you disabled the wrap functionality for all of the DataGrid, text wrapping functionality is not disabled for every row or column.

How can I place text in the rowheader column of my datagrid?

Windows Forms FAQ - Windows Forms Datagrid
There is no text property exposed for a rowheader cell. But you can handle the Paint event and draw header text yourself. You can download sample projects (C#, VB) that illustrate one technique for doing so. The sample loads the datagrid in the form's Load event. In addition, this event is used to set the rowheaderwidth of the datagrid, and to remember the point where cell 0,0 is located. This point will allow us to find the toprow number when we need it to start drawing the header text.

How do I add text to the row header, e.g., a row number, in a DataGridView?

DataGridView - Windows Forms FAQs
You can set a row's HeaderCell.Value property to a value and it will be painted. Alternatively - and fairly easy - handle the RowPostPaint and paint the row number in the header cell like so: Private Sub dataGridView1_RowPostPaint(ByVal sender As...

Can I display a fixed row/column on the bottom/right with JTable?

JTable and TableModel: FAQ
This is not possible with a single standard JScrollPane. It must be (non-easily) extended to support it. It may be possible to use two JScrollPanes, both with a JTable, and synchronize them, but that is difficult. soon as you do any modifications to the TableColumnModel, I would do everything explicitly and not rely on JTable's implicit changes that happen when its property autoCreateColumnsFromModel is true. Creating default columns is done like this:TableModel data = ..

Why doesn't JTable display its column header?

JTable and TableModel: FAQ
The column headers are displayed by a separate component, a JTableHeader. If the JTable is put inside a JScrollPane, it adds the header automatically as column header of the JScrollPane. If you don't put it into a JScrollPane, you have to add the header by hand (it's probably the best to use a BorderLayout).pane.setLayout(new BorderLayout()); // unless already there pane.add(table, BorderLayout.CENTER); pane.add(table.getTableHeader(), BorderLayout.

How can I make the DataGrid column be blank and not display (null) as the default value?

Windows Forms FAQ - Windows Forms Datagrid
When you go to a new row in a DataGrid, the columns display (null). To prevent this behavior and make all the columns be empty, you can set the DefaultValue property of the DataColumn to be String.Empty.

How do I perform custom handling of a double-click in a DataGrid's column header cell?

DataGrid - Windows Forms FAQs
You can handle the DataGrid's DoubleClick event, and use the HitTest method to test if the double-click was on a column header. using System; using System.Drawing; using System.Windows.Forms; private DataGrid dataGrid1; // ... dataGrid1.DoubleClick...

How can I have an onclick event in the DataGrid for any Column?

Datagrid Web Control in Asp.net , Problems, Issues and FAQs ...
lt;asp:DataGrid id="DataGrid1" OnItemDataBound ="ItemDB" DataKeyField ="ProductId" runat="server"></asp:DataGrid> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Protected Sub ItemDB(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) e.Item.Cells[dc.IndexOf(dc[dcCol.ColumnName])].Attributes.Add("onclick", "javascript:window.open('details.aspx?id= "+strID+"',"+"'MyPage','height=300,width=300')");

I want to display a simple text to a cell while its column has an editor associated. Is it possible?

Exontrol Software - ExGrid FAQ page
If the column has associated an editor all cells in the column display the cell's value depending on the type of the column's editor. For instance if you have an editor of DropDown type, the cell's value should be the value of the item in the predefined list.

Do I need to install anything on my computer to see the text display?

eScription FAQ Page
If a JRE (Java Runtime Environment) or JVM (Java Virtual Machine) was not installed with your operating system or your web browser, you may need to install the Java Plug-in to run Java applications in your web browser. Your web browser may offer you a link to download and install a JRE or Java Plug-in, if no JRE is present. If your web browser offers you a link to download and install a JRE, JVM, or Java Plug-in, please follow the instructions offered by your web browser.

Can you display a text field as a TEXTAREA?

Nav1
Simply code your text field as "Allow multi-values", then on the Options tab, check "New line" for "Separate values when user enters" and "Display separate values with". This plain text field will then be displayed as a TEXTAREA. You can set the HTML attributes of the field to adjust the size of the TEXTAREA.
More Questions >>

© Copyright 2007-2012 QueryCAT
About • Webmasters • Contact