Hi folks,
I found a simpler way based on another suggestion I ran across. If you
go into the property builder for the datagrid and selection the column
that contains the pushbutton, then you can select at the bottom of the
property builder to change the column to a template. In the template,
the button will be of type "asp:Button" (instead of asp:BoundColumn) to
which you can simply
add the cssClass attribute and specify an external stylesheet.
Here are examples of the result of converting select, remove, edit,
update, cancel, and an editable column to templates and applying the
pertinent cssClass as defined in my external stylesheet:
1. Example of editItem textbox converted to a template
(in the ItemTemplate it is represented by a label,
but in the EditItemTemplate it is represented by a
textbox):
<asp:TemplateColumn HeaderText="Hours">
<ItemTemplate>
<asp:Label CssClass="label" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox CssClass="textbox" runat="server"
Text='<%# DataBinder.Eval(Container,
"DataItem.Hours") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
2. Example of edit/update/cancel push buttons that
were converted into a template:
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Edit" CommandName="Edit"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
<EditItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Update" CommandName="Update">
</asp:Button>
<asp:Button CssClass="datagrid" runat="server"
Text="Cancel" CommandName="Cancel"
CausesValidation="false">
</asp:Button>
</EditItemTemplate>
</asp:TemplateColumn>
3. Example of a delete push button that was
converted into a template:
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Remove" CommandName="Delete"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
4. Example of a select push button that was
converted into a template:
<asp:TemplateColumn>
<ItemTemplate>
<asp:Button CssClass="datagrid" runat="server"
Text="Add" CommandName="Select"
CausesValidation="false">
</asp:Button>
</ItemTemplate>
</asp:TemplateColumn>
The Lord Reigns!
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!