Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Format datagrid columns

Reply
Thread Tools

Format datagrid columns

 
 
ton
Guest
Posts: n/a
 
      02-18-2004
Hi,
How can I format (width, wordwrap) of a during runtime added boundcontrol
Ton


 
Reply With Quote
 
 
 
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
are you adding a boundColumn at runtime ?
What exactly is the control you are adding at runtime. If its a BoundColumn,
it already exposes various header/item/footer style properties which you can
use for formatting . .look in the BoundColumn Members section

"ton" <> wrote in message
news:c0vvff$4bk$...
> Hi,
> How can I format (width, wordwrap) of a during runtime added boundcontrol
> Ton
>
>



 
Reply With Quote
 
 
 
 
ton
Guest
Posts: n/a
 
      02-19-2004
I add a Buttoncolumn, allthough I rather add a button with a text on it.
This column is bound to the dataset. And for the other columns I add
Boundcolumns, but the do not look good.
Text is wrapped up (several lines) and I cannot set the with of a column.

Do you have any suggestions (and/or additional reading)

Thanks
"Alessandro Zifiglio" <> schreef in
bericht news:NB2Zb.9070$...
> are you adding a boundColumn at runtime ?
> What exactly is the control you are adding at runtime. If its a

BoundColumn,
> it already exposes various header/item/footer style properties which you

can
> use for formatting . .look in the BoundColumn Members section
>
> "ton" <> wrote in message
> news:c0vvff$4bk$...
> > Hi,
> > How can I format (width, wordwrap) of a during runtime added

boundcontrol
> > Ton
> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
boundcolumn1.ItemStyle.Wrap = True
sets wrapping for all item cells of the column

"ton" <> wrote in message
news:c12f6j$ubd$...
> I add a Buttoncolumn, allthough I rather add a button with a text on it.
> This column is bound to the dataset. And for the other columns I add
> Boundcolumns, but the do not look good.
> Text is wrapped up (several lines) and I cannot set the with of a column.
>
> Do you have any suggestions (and/or additional reading)
>
> Thanks
> "Alessandro Zifiglio" <> schreef in
> bericht news:NB2Zb.9070$...
> > are you adding a boundColumn at runtime ?
> > What exactly is the control you are adding at runtime. If its a

> BoundColumn,
> > it already exposes various header/item/footer style properties which you

> can
> > use for formatting . .look in the BoundColumn Members section
> >
> > "ton" <> wrote in message
> > news:c0vvff$4bk$...
> > > Hi,
> > > How can I format (width, wordwrap) of a during runtime added

> boundcontrol
> > > Ton
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      02-19-2004
Perfect !
When the previous button works in the datagrid then this control would be
very usefull.
Next is still possible, but previous canbe pushed after 1 or more next (>),
buto does not change the rows which are displayes and is then disabled
(allthough I pushed several time on next)

Ton



"Alessandro Zifiglio" <> schreef in
bericht news:Xw3Zb.9092$...
> boundcolumn1.ItemStyle.Wrap = True
> sets wrapping for all item cells of the column
>
> "ton" <> wrote in message
> news:c12f6j$ubd$...
> > I add a Buttoncolumn, allthough I rather add a button with a text on it.
> > This column is bound to the dataset. And for the other columns I add
> > Boundcolumns, but the do not look good.
> > Text is wrapped up (several lines) and I cannot set the with of a

column.
> >
> > Do you have any suggestions (and/or additional reading)
> >
> > Thanks
> > "Alessandro Zifiglio" <> schreef

in
> > bericht news:NB2Zb.9070$...
> > > are you adding a boundColumn at runtime ?
> > > What exactly is the control you are adding at runtime. If its a

> > BoundColumn,
> > > it already exposes various header/item/footer style properties which

you
> > can
> > > use for formatting . .look in the BoundColumn Members section
> > >
> > > "ton" <> wrote in message
> > > news:c0vvff$4bk$...
> > > > Hi,
> > > > How can I format (width, wordwrap) of a during runtime added

> > boundcontrol
> > > > Ton
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
almost forgot, for the width do :
boundcolumn1.ItemStyle.Width = Unit.Pixel(100)
"Alessandro Zifiglio" <> wrote in
message news:Xw3Zb.9092$...
> boundcolumn1.ItemStyle.Wrap = True
> sets wrapping for all item cells of the column
>
> "ton" <> wrote in message
> news:c12f6j$ubd$...
> > I add a Buttoncolumn, allthough I rather add a button with a text on it.
> > This column is bound to the dataset. And for the other columns I add
> > Boundcolumns, but the do not look good.
> > Text is wrapped up (several lines) and I cannot set the with of a

column.
> >
> > Do you have any suggestions (and/or additional reading)
> >
> > Thanks
> > "Alessandro Zifiglio" <> schreef

in
> > bericht news:NB2Zb.9070$...
> > > are you adding a boundColumn at runtime ?
> > > What exactly is the control you are adding at runtime. If its a

> > BoundColumn,
> > > it already exposes various header/item/footer style properties which

you
> > can
> > > use for formatting . .look in the BoundColumn Members section
> > >
> > > "ton" <> wrote in message
> > > news:c0vvff$4bk$...
> > > > Hi,
> > > > How can I format (width, wordwrap) of a during runtime added

> > boundcontrol
> > > > Ton
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
This last one is probably a bug in your application. I suggest you try and
run in debug mode again and step through this line by line and see the
execution of your code and what happens as you hit the next or previous
buttons.

The previous button should be able to go all the way to the first page and
then stay disabled if its the first page, and the next button should be able
to go to the last record and then disable on the last. Try and use numbered
links and see if your getting the same behavior whereas to next-previous
links. That is set pager mode to NumericPages whereas to NextPrev.

From your previous posts i've noted that you are doing this correctly and
are also using the OnPageIndexChanged method correctly, so surely you have a
small bug in your code.

"Alessandro Zifiglio" <> wrote in
message news:XB3Zb.9094$...
> almost forgot, for the width do :
> boundcolumn1.ItemStyle.Width = Unit.Pixel(100)
> "Alessandro Zifiglio" <> wrote in
> message news:Xw3Zb.9092$...
> > boundcolumn1.ItemStyle.Wrap = True
> > sets wrapping for all item cells of the column
> >
> > "ton" <> wrote in message
> > news:c12f6j$ubd$...
> > > I add a Buttoncolumn, allthough I rather add a button with a text on

it.
> > > This column is bound to the dataset. And for the other columns I add
> > > Boundcolumns, but the do not look good.
> > > Text is wrapped up (several lines) and I cannot set the with of a

> column.
> > >
> > > Do you have any suggestions (and/or additional reading)
> > >
> > > Thanks
> > > "Alessandro Zifiglio" <> schreef

> in
> > > bericht news:NB2Zb.9070$...
> > > > are you adding a boundColumn at runtime ?
> > > > What exactly is the control you are adding at runtime. If its a
> > > BoundColumn,
> > > > it already exposes various header/item/footer style properties which

> you
> > > can
> > > > use for formatting . .look in the BoundColumn Members section
> > > >
> > > > "ton" <> wrote in message
> > > > news:c0vvff$4bk$...
> > > > > Hi,
> > > > > How can I format (width, wordwrap) of a during runtime added
> > > boundcontrol
> > > > > Ton
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      02-19-2004
I will do what you suggest.

In the mean time I'm trying to handle the event of the buttoncolumn. I
receive the event, but I want to get the ID of the row:

col = New ButtonColumn '' BoundColumn

col.HeaderText = "ID"

col.DataTextField = "ID"

col.ButtonType = ButtonColumnType.PushButton

col.HeaderStyle.Wrap = False

col.CommandName = "Card"

Datagrid.Columns.Add(col)

AddHandler Datagrid.ItemCommand, AddressOf Me.DataGridCard

----
the datagridcard procedure
Private Sub DataGridCard(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs )

Dim datagrid As DataGrid, x As Label

datagrid = CType(sender, DataGrid)

x = FindControl("X")

datagrid.EditItemIndex = e.Item.ItemIndex

x.Text = "Xpage " + CStr(e.CommandName) + " " & e.Item.ItemIndex &
e.CommandArgument ''DataItem

datagrid.DataBind()

End Sub

Since the buttoncolumn displays the recordnumber I want to get that ID. With
that ID i can call my dialog to edit the cardrecord.
How do I get there. The datagrid.edititemindex only modifies the way the
record is shown (an you may edit it), buto that's not what I want to do,
Thanks

Ton



"Alessandro Zifiglio" <> schreef in
bericht news:rK3Zb.9099$...
> This last one is probably a bug in your application. I suggest you try and
> run in debug mode again and step through this line by line and see the
> execution of your code and what happens as you hit the next or previous
> buttons.
>
> The previous button should be able to go all the way to the first page and
> then stay disabled if its the first page, and the next button should be

able
> to go to the last record and then disable on the last. Try and use

numbered
> links and see if your getting the same behavior whereas to next-previous
> links. That is set pager mode to NumericPages whereas to NextPrev.
>
> From your previous posts i've noted that you are doing this correctly and
> are also using the OnPageIndexChanged method correctly, so surely you have

a
> small bug in your code.
>
> "Alessandro Zifiglio" <> wrote in
> message news:XB3Zb.9094$...
> > almost forgot, for the width do :
> > boundcolumn1.ItemStyle.Width = Unit.Pixel(100)
> > "Alessandro Zifiglio" <> wrote in
> > message news:Xw3Zb.9092$...
> > > boundcolumn1.ItemStyle.Wrap = True
> > > sets wrapping for all item cells of the column
> > >
> > > "ton" <> wrote in message
> > > news:c12f6j$ubd$...
> > > > I add a Buttoncolumn, allthough I rather add a button with a text on

> it.
> > > > This column is bound to the dataset. And for the other columns I add
> > > > Boundcolumns, but the do not look good.
> > > > Text is wrapped up (several lines) and I cannot set the with of a

> > column.
> > > >
> > > > Do you have any suggestions (and/or additional reading)
> > > >
> > > > Thanks
> > > > "Alessandro Zifiglio" <>

schreef
> > in
> > > > bericht news:NB2Zb.9070$...
> > > > > are you adding a boundColumn at runtime ?
> > > > > What exactly is the control you are adding at runtime. If its a
> > > > BoundColumn,
> > > > > it already exposes various header/item/footer style properties

which
> > you
> > > > can
> > > > > use for formatting . .look in the BoundColumn Members section
> > > > >
> > > > > "ton" <> wrote in message
> > > > > news:c0vvff$4bk$...
> > > > > > Hi,
> > > > > > How can I format (width, wordwrap) of a during runtime added
> > > > boundcontrol
> > > > > > Ton
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      02-19-2004
allthough I have an event firing on:
AddHandler Datagrid.PageIndexChanged, AddressOf Me.nextprev

The debugmode only enters the next buton, when clicking previous, the
NextPrev event is not called ?

Private Sub nextprev(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)

Dim datagrid As DataGrid, x As Label

datagrid = CType(sender, DataGrid)

datagrid.CurrentPageIndex = e.NewPageIndex

datagrid.DataBind()

End Sub


"Alessandro Zifiglio" <> schreef in
bericht news:rK3Zb.9099$...
> This last one is probably a bug in your application. I suggest you try and
> run in debug mode again and step through this line by line and see the
> execution of your code and what happens as you hit the next or previous
> buttons.
>
> The previous button should be able to go all the way to the first page and
> then stay disabled if its the first page, and the next button should be

able
> to go to the last record and then disable on the last. Try and use

numbered
> links and see if your getting the same behavior whereas to next-previous
> links. That is set pager mode to NumericPages whereas to NextPrev.
>
> From your previous posts i've noted that you are doing this correctly and
> are also using the OnPageIndexChanged method correctly, so surely you have

a
> small bug in your code.
>
> "Alessandro Zifiglio" <> wrote in
> message news:XB3Zb.9094$...
> > almost forgot, for the width do :
> > boundcolumn1.ItemStyle.Width = Unit.Pixel(100)
> > "Alessandro Zifiglio" <> wrote in
> > message news:Xw3Zb.9092$...
> > > boundcolumn1.ItemStyle.Wrap = True
> > > sets wrapping for all item cells of the column
> > >
> > > "ton" <> wrote in message
> > > news:c12f6j$ubd$...
> > > > I add a Buttoncolumn, allthough I rather add a button with a text on

> it.
> > > > This column is bound to the dataset. And for the other columns I add
> > > > Boundcolumns, but the do not look good.
> > > > Text is wrapped up (several lines) and I cannot set the with of a

> > column.
> > > >
> > > > Do you have any suggestions (and/or additional reading)
> > > >
> > > > Thanks
> > > > "Alessandro Zifiglio" <>

schreef
> > in
> > > > bericht news:NB2Zb.9070$...
> > > > > are you adding a boundColumn at runtime ?
> > > > > What exactly is the control you are adding at runtime. If its a
> > > > BoundColumn,
> > > > > it already exposes various header/item/footer style properties

which
> > you
> > > > can
> > > > > use for formatting . .look in the BoundColumn Members section
> > > > >
> > > > > "ton" <> wrote in message
> > > > > news:c0vvff$4bk$...
> > > > > > Hi,
> > > > > > How can I format (width, wordwrap) of a during runtime added
> > > > boundcontrol
> > > > > > Ton
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alessandro Zifiglio
Guest
Posts: n/a
 
      02-19-2004
the onitemcommand is the right place for this. however try Try :
dim MyButton as string
MyButton = CType(e.CommandSource, Button).CommandName


Not sure where you are stuck, are you saying your unable to retrieve what
you stored in the buttons commandName, and commandArugment values or your
not able to get the cell where this button is located

"ton" <> wrote in message
news:c12li9$okk$...
> I will do what you suggest.
>
> In the mean time I'm trying to handle the event of the buttoncolumn. I
> receive the event, but I want to get the ID of the row:
>
> col = New ButtonColumn '' BoundColumn
>
> col.HeaderText = "ID"
>
> col.DataTextField = "ID"
>
> col.ButtonType = ButtonColumnType.PushButton
>
> col.HeaderStyle.Wrap = False
>
> col.CommandName = "Card"
>
> Datagrid.Columns.Add(col)
>
> AddHandler Datagrid.ItemCommand, AddressOf Me.DataGridCard
>
> ----
> the datagridcard procedure
> Private Sub DataGridCard(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs )
>
> Dim datagrid As DataGrid, x As Label
>
> datagrid = CType(sender, DataGrid)
>
> x = FindControl("X")
>
> datagrid.EditItemIndex = e.Item.ItemIndex
>
> x.Text = "Xpage " + CStr(e.CommandName) + " " & e.Item.ItemIndex &
> e.CommandArgument ''DataItem
>
> datagrid.DataBind()
>
> End Sub
>
> Since the buttoncolumn displays the recordnumber I want to get that ID.

With
> that ID i can call my dialog to edit the cardrecord.
> How do I get there. The datagrid.edititemindex only modifies the way the
> record is shown (an you may edit it), buto that's not what I want to do,
> Thanks
>
> Ton
>
>
>
> "Alessandro Zifiglio" <> schreef in
> bericht news:rK3Zb.9099$...
> > This last one is probably a bug in your application. I suggest you try

and
> > run in debug mode again and step through this line by line and see the
> > execution of your code and what happens as you hit the next or previous
> > buttons.
> >
> > The previous button should be able to go all the way to the first page

and
> > then stay disabled if its the first page, and the next button should be

> able
> > to go to the last record and then disable on the last. Try and use

> numbered
> > links and see if your getting the same behavior whereas to next-previous
> > links. That is set pager mode to NumericPages whereas to NextPrev.
> >
> > From your previous posts i've noted that you are doing this correctly

and
> > are also using the OnPageIndexChanged method correctly, so surely you

have
> a
> > small bug in your code.
> >
> > "Alessandro Zifiglio" <> wrote in
> > message news:XB3Zb.9094$...
> > > almost forgot, for the width do :
> > > boundcolumn1.ItemStyle.Width = Unit.Pixel(100)
> > > "Alessandro Zifiglio" <> wrote

in
> > > message news:Xw3Zb.9092$...
> > > > boundcolumn1.ItemStyle.Wrap = True
> > > > sets wrapping for all item cells of the column
> > > >
> > > > "ton" <> wrote in message
> > > > news:c12f6j$ubd$...
> > > > > I add a Buttoncolumn, allthough I rather add a button with a text

on
> > it.
> > > > > This column is bound to the dataset. And for the other columns I

add
> > > > > Boundcolumns, but the do not look good.
> > > > > Text is wrapped up (several lines) and I cannot set the with of a
> > > column.
> > > > >
> > > > > Do you have any suggestions (and/or additional reading)
> > > > >
> > > > > Thanks
> > > > > "Alessandro Zifiglio" <>

> schreef
> > > in
> > > > > bericht news:NB2Zb.9070$...
> > > > > > are you adding a boundColumn at runtime ?
> > > > > > What exactly is the control you are adding at runtime. If its a
> > > > > BoundColumn,
> > > > > > it already exposes various header/item/footer style properties

> which
> > > you
> > > > > can
> > > > > > use for formatting . .look in the BoundColumn Members section
> > > > > >
> > > > > > "ton" <> wrote in message
> > > > > > news:c0vvff$4bk$...
> > > > > > > Hi,
> > > > > > > How can I format (width, wordwrap) of a during runtime added
> > > > > boundcontrol
> > > > > > > Ton
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
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
Format datagrid across several columns Andy ASP .Net 0 05-08-2006 02:18 PM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM
Binded Datagrid Formatting columns or hiding columns ton ASP .Net Web Controls 2 02-11-2004 04:09 AM
Format output of dynamic Datagrid columns J.B ASP .Net 1 10-23-2003 05:11 PM
Columns and Inherited Datagrid...Active Schema does not support columns rob thomson ASP .Net Datagrid Control 0 09-04-2003 03:09 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57