Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Please answer <<<<<<<<<<<<<<<<<<

Reply
Thread Tools

Please answer <<<<<<<<<<<<<<<<<<

 
 
Gary
Guest
Posts: n/a
 
      04-02-2004
Nobody answered my previous post from last night. I
would really like to get this solved. Is is puzzling.

I want to change the layout of columns in a datagrid. I
want to change the heading and the width of columns. In
the Load Event on the form, I have the following code:

Dim tsNotes As New DataGridTableStyle
tsNotes.MappingName = "Notes"

Dim cstDate As New DataGridTextBoxColumn
cstDate.MappingName = "NoteDate"
cstDate.HeaderText = "Note Date"
cstDate.Width = 1650

Dim cstStartTime As New DataGridTextBoxColumn
cstStartTime.MappingName = "StartTime"
cstStartTime.HeaderText = "Start Time"
cstStartTime.Width = 1550

Dim cstEndTime As New DataGridTextBoxColumn
cstEndTime.MappingName = "EndTime"
cstEndTime.HeaderText = "End Time"
cstEndTime.Width = 1550

tsNotes.GridColumnStyles.Add(cstDate)
tsNotes.GridColumnStyles.Add(cstStartTime)
tsNotes.GridColumnStyles.Add(cstEndTime)

Me.DG_Notes.TableStyles.Add(tsNotes)

But when I run this code, I can see no columns at all.
If I change themapping name from "Notes" to "PNotes",
these styles do not get applied. If I leave it
at "Notes" I can't see any columns. What am I doing
wrong?

Any help would be appreciated.

Thanks in advance,

Gary

..


 
Reply With Quote
 
 
 
 
Alvin Bruney [MVP]
Guest
Posts: n/a
 
      04-04-2004
One other approach is to trap the itemcreated or itemdatabound event handler
and adjust the column attributes there

e.item.cells[2].width = 10 roughly

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Gary" <(E-Mail Removed)> wrote in message
news:14cbe01c41906$59450450$(E-Mail Removed)...
> Nobody answered my previous post from last night. I
> would really like to get this solved. Is is puzzling.
>
> I want to change the layout of columns in a datagrid. I
> want to change the heading and the width of columns. In
> the Load Event on the form, I have the following code:
>
> Dim tsNotes As New DataGridTableStyle
> tsNotes.MappingName = "Notes"
>
> Dim cstDate As New DataGridTextBoxColumn
> cstDate.MappingName = "NoteDate"
> cstDate.HeaderText = "Note Date"
> cstDate.Width = 1650
>
> Dim cstStartTime As New DataGridTextBoxColumn
> cstStartTime.MappingName = "StartTime"
> cstStartTime.HeaderText = "Start Time"
> cstStartTime.Width = 1550
>
> Dim cstEndTime As New DataGridTextBoxColumn
> cstEndTime.MappingName = "EndTime"
> cstEndTime.HeaderText = "End Time"
> cstEndTime.Width = 1550
>
> tsNotes.GridColumnStyles.Add(cstDate)
> tsNotes.GridColumnStyles.Add(cstStartTime)
> tsNotes.GridColumnStyles.Add(cstEndTime)
>
> Me.DG_Notes.TableStyles.Add(tsNotes)
>
> But when I run this code, I can see no columns at all.
> If I change themapping name from "Notes" to "PNotes",
> these styles do not get applied. If I leave it
> at "Notes" I can't see any columns. What am I doing
> wrong?
>
> Any help would be appreciated.
>
> Thanks in advance,
>
> Gary
>
> .
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrong answer equals to a blank answer or not? Zadkin Microsoft Certification 8 06-27-2006 01:51 PM
70-292: can someone please verify / explain the answer to this question Tim Moor MCSE 7 12-18-2005 03:30 AM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM
PRETTY PLEASE...need answer to why "this method should result in NodeSet" error KathyB ASP .Net 0 07-25-2003 04:59 AM



Advertisments