By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 1,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

CssClass on DataGrid Edit, Update & Cancel buttons

P: n/a
I have a DataGrid with an EditCommandColumn column set to a type of PushButton. I want to set set CssClass on these buttons and cannot without using code-behind code on the ItemDataBound event. The project lead does not want me to do this with code as he thinks it is too complex. But I cannot find a property in Design View or HTML View that works. Otherwise the edit buttons do not match the appearance of other buttons on the screen.

Here is the HTML definiton of the web form:

<form id="Form1" method="post" runat="server">
<TABLE id="tblDetail" style="HEIGHT: 34px" cellSpacing="1" cellPadding="1" width="99%"
<TD width="120"><INPUT class="Buttons" id="clientBtnClose" onclick="CloseWindow();" type="button" value="Close Window"></TD>
<td><asp:label id="lblErrorMsg" runat="server" ForeColor="Red" Font-Bold="True" BackColor="Transparent"></asp:label></td>
<asp:datagrid id="grdCycleStatusList" runat="server" Width="99%" ShowFooter="True" AutoGenerateColumns="False"
DataKeyField="CycleStatusID" CssClass="DataGrid" BorderColor="#4A3C8C">
<AlternatingItemStyle CssClass="DataGridAlternatingItem"></AlternatingItemStyle>
<ItemStyle CssClass="DataGridItem"></ItemStyle>
<HeaderStyle CssClass="DataGridHeader"></HeaderStyle>
<asp:TemplateColumn HeaderText="Cycle Description">
<asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.StatusDescription") %>'>
<asp:TextBox id="txtCycleDescription_ADD" CssClass="Edit" Runat="server"></asp:TextBox>
<asp:RequiredFieldValidator id="rfvDescription_Add" runat="server" Text="Required" ControlToValidate="txtCycleDescription_ADD"
<asp:TextBox id=txtCycleDescription runat="server" CssClass="Edit" Text='<%# DataBinder.Eval(Container, "DataItem.StatusDescription") %>'>
<asp:RequiredFieldValidator id="rfvDescription_Edit" runat="server" Text="Required" ControlToValidate="txtCycleDescription"
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel"
EditText=" Edit ">
<ItemStyle CssClass="Buttons"></ItemStyle>
<asp:Button id="btnAddNew" Width="100%" CssClass="Buttons" Text="Add" Runat="server" CommandName="ADD_NEW"></asp:Button>
Thanks in advance!

Steve Kallal
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.