473,385 Members | 1,973 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Define Columns

Hi everybody

I need your help
With this code read data from table Usuarios and I show it in a Datagrid.

cn.Open ();
SqlDataAdapter da = new SqlDataAdapter("Select Usuario,Apellidos from
Usuarios;",cn);
DataSet ds = new DataSet();
da.Fill(ds,"Usuarios");
DataView dvUsuarios = new DataView(ds.Tables["Usuarios"]);
dgUsuarios.DataSource = dvUsuarios;

How can I do to define headers and width of columns?

Thx
Pablo Salazar
Guatemala
Nov 16 '05 #1
4 1787
Apply a DataGridTableStyle to the grid to control its appearance

DataGridTableStyle tableStyle = new DatagridTableStyle()
TableStyle.MappingName = "Usuarios"

DataGridTextBoxColumn column1 = new DatgridTextBoxColumn()
column1.MappingName = "Usuario"
column1.HeaderText = "My Column Header"
column1.Width = 150

tableStyle.GridColumnStyles.Add(column1)

// repeat for other column(s

datGrid1.TableStyles.Add(tableStyle)
Charlie
Nov 16 '05 #2
thanks.
That's i was looking for.
"Charlie Williams" <an*******@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com...
Apply a DataGridTableStyle to the grid to control its appearance.

DataGridTableStyle tableStyle = new DatagridTableStyle();
TableStyle.MappingName = "Usuarios";

DataGridTextBoxColumn column1 = new DatgridTextBoxColumn();
column1.MappingName = "Usuario";
column1.HeaderText = "My Column Header";
column1.Width = 150;

tableStyle.GridColumnStyles.Add(column1);

// repeat for other column(s)

datGrid1.TableStyles.Add(tableStyle);

Charlie

Nov 16 '05 #3
Apply a DataGridTableStyle to the grid to control its appearance

DataGridTableStyle tableStyle = new DatagridTableStyle()
TableStyle.MappingName = "Usuarios"

DataGridTextBoxColumn column1 = new DatgridTextBoxColumn()
column1.MappingName = "Usuario"
column1.HeaderText = "My Column Header"
column1.Width = 150

tableStyle.GridColumnStyles.Add(column1)

// repeat for other column(s

datGrid1.TableStyles.Add(tableStyle)
Charlie
Nov 16 '05 #4
thanks.
That's i was looking for.
"Charlie Williams" <an*******@discussions.microsoft.com> wrote in message
news:35**********************************@microsof t.com...
Apply a DataGridTableStyle to the grid to control its appearance.

DataGridTableStyle tableStyle = new DatagridTableStyle();
TableStyle.MappingName = "Usuarios";

DataGridTextBoxColumn column1 = new DatgridTextBoxColumn();
column1.MappingName = "Usuario";
column1.HeaderText = "My Column Header";
column1.Width = 150;

tableStyle.GridColumnStyles.Add(column1);

// repeat for other column(s)

datGrid1.TableStyles.Add(tableStyle);

Charlie

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Pablo Salazar | last post by:
Hi everybody I need your help With this code read data from table Usuarios and I show it in a Datagrid. cn.Open (); SqlDataAdapter da = new SqlDataAdapter("Select Usuario,Apellidos from...
2
by: Pablo Salazar | last post by:
Hi everybody I need your help With this code read data from table Usuarios and I show it in a Datagrid. cn.Open (); SqlDataAdapter da = new SqlDataAdapter("Select Usuario,Apellidos from...
0
by: Pablo Salazar | last post by:
Hi everybody I need your help With this code read data from table Usuarios and I show it in a Datagrid. cn.Open (); SqlDataAdapter da = new SqlDataAdapter("Select Usuario,Apellidos from...
1
by: karunakar | last post by:
Iam binding datagrid using Datatable . How to define width for Datagrid header dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32))); using this i was populating datagrid Regards
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.