Change the datagrid column header text / title
Tech-Today

Change the datagrid column header text / title


Using .Net1.1, I experienced a problem on how I could change the header text of a datagrid. Normally, you can set it like this (using the DataGridTableStyle):

DataSet ds = query("Select field_name from table");
datagrid.DataSource = ds.Tables[0];

//and NAME will be displayed as the datagrid's headertext.

DataGridTableStyle style = new DataGridTableStyle();
DataGridColumnStyle colStyle = new DataGridTextBoxColumn();
colStyle.HeaderText = "NAME";
colStyle.MappingName = "field_name";
style.GridColumnStyles.Add(colStyle);
datagrid.TableStyles.Add(style);

//Unfortunately it's not working.
//An alternative is to rename the column in the sql query:


DataSet ds = query("Select field_name AS NEW_FIELD_NAME from table");
datagrid.DataSource = ds.Tables[0];




- How To Execute Select Count(*), Field From Table Group By Field In Entity Framework
As the title implies we will try to convert a native sql that group and counts the number of row. We will assume that you have a column quantity or number of items. //native query select count(*), field from table group by field //entity framework var...

- Mssql How To Update A Column Base On A Row Number
Just recently I was asked to normalized or divide a table into 2 tables. Unfortunately, the only column that linked them (email) allows multiple same values, even aggregate would not do (email, password, etc). This is because there's a field that...

- Select Top, Limit Workaround On Sqlce 2.0 Or Limiting The Number Of Rows/getting A Range From A Dataset
Problem: -In SQLCE 2.0 it is documented that 2 of the common used keywords are not supported in gettings a range of records from a dataset. They are LIMIT and TOP which are use this way: LIMIT: SELECT * FROM tableA LIMIT 5, 10; This query will select...

- Table Of Contents
ol li a, ol li a:active, ol li a:link, ol li a:visited { color: #000; } ...

- Select All Checkbox Or Element In A Form Html
Creating a form dynamically at run time – this also means we should give unique names to each html controls. For example we have a datagrid like object and its first column is checkbox, how should we check all of the rows. Here is my code that iterates...



Tech-Today








.