Dynamically changing styles in DataGrid
- From: "tshad" <t@xxxxxxxx>
- Date: Wed, 22 Aug 2007 19:41:45 -0700
I am trying to build a datagrid that is customizable by my clients.
I can hide and show columns or changes sizes of the Columns or DataGrid
itslef from the Page_PreRender event that works pretter well.
DataGrid1.Width = new Unit("551px")
for each col as DataGridColumn in DataGrid1.Columns
if col.HeaderText = "Company" orElse col.HeaderText = "Posted" then
col.Visible = false
end if
next
The sizing of the DataGrid (shown above) only works if the size is set by
"Width", ie:
<anthem:DataGrid
Visible=true
AllowSorting="false"
AutoGenerateColumns="false"
CellPadding="0"
CellSpacing="0"
ID="DataGrid2"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="0"
BorderColor="#999999"
Width="701px"
style="padding-right:5px">
If, however, I tried to use a style - the style seems to get applied AFTER
the PreRender event, ie:
<anthem:DataGrid
Visible=true
AllowSorting="false"
AutoGenerateColumns="false"
CellPadding="0"
CellSpacing="0"
ID="DataGrid2"
runat="server"
ShowFooter="false"
ShowHeader="true"
OnSortCommand="SortDataGrid"
BorderWidth="0"
BorderColor="#999999"
style="padding-right:5px;width=701px">
In this example, the size of the table would be 701px instead of the 551px I
changed it to in the PreRender. The first example works fine:
How can I do this in the PreRender section (or another area) if the size is
set in a style?
Thanks,
Tom
.
- Follow-Ups:
- Re: Dynamically changing styles in DataGrid
- From: marss
- Re: Dynamically changing styles in DataGrid
- Prev by Date: Virtual Directory not working
- Next by Date: Re: Ask for source code for a simple forum.
- Previous by thread: Virtual Directory not working
- Next by thread: Re: Dynamically changing styles in DataGrid
- Index(es):
Relevant Pages
|