alain123
asked on
datagrid css
on a dynamically created datagrid, how do you add programatically css to the Main TR and TD of the datagrid
OMSmartGrid.HeaderStyle ?
OMSmartGrid.HeaderStyle ?
Yes, you use DataGrid.HeaderStyle. You can assign it a CssClass using MyDataGrid.HeaderStyle.Css Class, or you can set things separately, e.g. MyDataGrid.HeaderStyle.Bor derWidth
ASKER
i'm really looking to assign css classes to the main TR and TD of the datagrid
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you, that's a solution to the problem.. too bad it cannot be on the c# code
ASKER
by any chance do you know how to set only the outside border?
Grid.BorderStyle = System.Web.UI.WebControls.
You don't have to use CSS, but it's easier as it removes some of the formatting from the code. You can still use MyGrid.HeaderStyle.ForeCol or etc. I'm not sure if you can get at the TDs directly but I don't know if you need this.
Regarding the BorderStyle, that should work fine. Be careful you aren't overriding it somewhere. I couldn't get BorderStyle to make much difference, but BorderColor worked fine.
Regarding the BorderStyle, that should work fine. Be careful you aren't overriding it somewhere. I couldn't get BorderStyle to make much difference, but BorderColor worked fine.
ASKER
ok thank you, i'll keep plaing with it.. still wasn't able to get the TD's on the c# code.. as for the border.. it's putting borders inside the grid too, not only outside as i wanted.. thanks
Well, if all else fails, this will put a border round the outside...
Grid.GridLines = GridLines.None;
Grid.Style.Add("border", "solid 1px black");
Grid.GridLines = GridLines.None;
Grid.Style.Add("border", "solid 1px black");
ASKER
perfect thank you!
ASKER