473,386 Members | 1,705 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,386 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 1788
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.