Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Miguel Ramirez #1
Re: datagrid codebehind formatting
What if columns are not boundColumns?
"Teemu Keiski" <joteke@aspalliance.com> escribió en el mensaje
news:eQZRrOYDEHA.1604@TK2MSFTNGP11.phx.gbl...> If columns are BoundColumns,. you can specify the format to the
> DataFormatString property of the column for example: "{0:dd/MM/yyyy}"
>
> --
> Teemu Keiski
> MCP, Microsoft MVP (ASP.NET), AspInsiders member
> ASP.NET Forum Moderator, AspAlliance Columnist
>
>
> "mark" <mark@remove.com> wrote in message
> news:xFV5c.601$K51.463@newsfe1-win...>> > how do i format datetime in codebehind ?
> > i use a dll with all my funtions in and the dates are coming out as
> > 15/03/2004 00:00:00
> > code is like this :-
> >
> >
> > Function AdminNotSubmitted(ByVal Datagrid As
> > System.Web.UI.WebControls.DataGrid, ByVal Title As String)
> >
> > Dim conn As New System.Data.SqlClient.SqlConnection(SQLstrConn)
> >
> > Dim sql As String = "blah"
> >
> > Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, conn)
> >
> > Dim ds As DataSet = New DataSet()
> >
> > da.Fill(ds)
> >
> > ds.Tables(0).Columns.Item(0).ColumnName = "ID "
> >
> > ds.Tables(0).Columns.Item(1).ColumnName = "Surname "
> >
> > ds.Tables(0).Columns.Item(2).ColumnName = "Mge Admin "
> >
> > ds.Tables(0).Columns.Item(3).ColumnName = "Date To Mge Admin "
> >
> >
> >
> > Datagrid.DataSource = ds.Tables(0)
> >
> > Datagrid.DataBind()
> >
> > Title = "blah"
> >
> > Return ds.Tables(0).Rows.Count()
> >
> > End Function
> >
> >
> > thanks
> >
> > mark
> >
> >
>
Miguel Ramirez Guest
-
Datagrid Formatting
I am trying to find out if it is possible to format a datagrid to display results in teh following manner; Job: 5453 South Ridge Lane ... -
Formatting a datagrid
Hi, I am working on my first web app that uses a datagrid. I can't seem to find good examples of formatting the grid the way you can in a Windows... -
Datagrid SelectedIndexChanged Problem in CodeBehind
I am attempting to use the SelectedIndexChanged to detect when a row has been selected. I have seen many examples where they are writing all the... -
Print asp:datagrid with formatting
Hi I need to Print asp:datagrid with formatting, which will avoid my writing of crystal reports and can directly print with click of a button. ... -
datagrid paging - codebehind
are you setting the button column to CommandName=Select in the ASP page? "Bent Kjeldsen" <news@nospam.dithjem.dk> wrote in message... -
Alvin Bruney [MVP] #2
Re: datagrid codebehind formatting
> What if columns are not boundColumns?
do the same thing in the itemdatabound event handler except that you would
use the cell variable
e.item.cells[0].text =
DateTime.Parse(e.item.cells[0].text).tostring("dd/MM/yyyy);
roughly (i wouldn't bet on this compiling but the idea is sound)
--
Regards,
Alvin Bruney
[ASP.NET MVP [url]http://mvp.support.microsoft.com/default.aspx][/url]
Got tidbits? Get it here... [url]http://tinyurl.com/27cok[/url]
"Miguel Ramirez" <miguel.ramirez@valycontrol.com.mx> wrote in message
news:%234ZlR76NEHA.620@TK2MSFTNGP10.phx.gbl...> What if columns are not boundColumns?
>
> "Teemu Keiski" <joteke@aspalliance.com> escribió en el mensaje
> news:eQZRrOYDEHA.1604@TK2MSFTNGP11.phx.gbl...>>> If columns are BoundColumns,. you can specify the format to the
>> DataFormatString property of the column for example: "{0:dd/MM/yyyy}"
>>
>> --
>> Teemu Keiski
>> MCP, Microsoft MVP (ASP.NET), AspInsiders member
>> ASP.NET Forum Moderator, AspAlliance Columnist
>>
>>
>> "mark" <mark@remove.com> wrote in message
>> news:xFV5c.601$K51.463@newsfe1-win...>>>> > how do i format datetime in codebehind ?
>> > i use a dll with all my funtions in and the dates are coming out as
>> > 15/03/2004 00:00:00
>> > code is like this :-
>> >
>> >
>> > Function AdminNotSubmitted(ByVal Datagrid As
>> > System.Web.UI.WebControls.DataGrid, ByVal Title As String)
>> >
>> > Dim conn As New System.Data.SqlClient.SqlConnection(SQLstrConn)
>> >
>> > Dim sql As String = "blah"
>> >
>> > Dim da As New System.Data.SqlClient.SqlDataAdapter(sql, conn)
>> >
>> > Dim ds As DataSet = New DataSet()
>> >
>> > da.Fill(ds)
>> >
>> > ds.Tables(0).Columns.Item(0).ColumnName = "ID "
>> >
>> > ds.Tables(0).Columns.Item(1).ColumnName = "Surname "
>> >
>> > ds.Tables(0).Columns.Item(2).ColumnName = "Mge Admin "
>> >
>> > ds.Tables(0).Columns.Item(3).ColumnName = "Date To Mge Admin "
>> >
>> >
>> >
>> > Datagrid.DataSource = ds.Tables(0)
>> >
>> > Datagrid.DataBind()
>> >
>> > Title = "blah"
>> >
>> > Return ds.Tables(0).Rows.Count()
>> >
>> > End Function
>> >
>> >
>> > thanks
>> >
>> > mark
>> >
>> >
>>
>
Alvin Bruney [MVP] Guest



Reply With Quote

