Is this what you are looking for?
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton runat="server" Text="Edit" CommandName="Edit" CausesValidation="false"></asp:LinkButton>
</ItemTemplate>
<EditItemTemplate>
<asp:LinkButton runat="server" Text="Update" CommandName="Update" CssClass="SomeClass"></asp:LinkButton
<asp:LinkButton runat="server" Text="Cancel" CommandName="Cancel" CausesValidation="false" CssClass="SomeClass"></asp:LinkButton>
</EditItemTemplate>
</asp:TemplateColumn>
"Steve Kallal" wrote:
> I have a DataGrid with an EditCommandColumn column set to type PushButton. I need to change the CssClass property on the Edit, Update & Cancel buttons when the grid is in edit mode. I cannot find a way to do this without using code. Otherwise the buttons appear larger than the other controls on the form. I have been able to accomplish this with some code on the grid's ItemDataBound event. But the boss thinks it is too complex. Is there a way to do this in the HMTL definition of the grid? Here is the HTML defintion of the grid:
>
> <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>
> <Columns>
> <asp:TemplateColumn HeaderText="Cycle Description">
> <ItemTemplate>
> <asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.StatusDescription") %>'>
> </asp:Label>
> </ItemTemplate>
> <FooterTemplate>
> <asp:TextBox id="txtCycleDescription_ADD" CssClass="Edit" Runat="server"></asp:TextBox>
> <asp:RequiredFieldValidator id="rfvDescription_Add" runat="server" Text="Required" ControlToValidate="txtCycleDescription_ADD"
> Display="Dynamic"></asp:RequiredFieldValidator>
> </FooterTemplate>
> <EditItemTemplate>
> <asp:TextBox id=txtCycleDescription runat="server" CssClass="Edit" Text='<%# DataBinder.Eval(Container, "DataItem.StatusDescription") %>'>
> </asp:TextBox>
> <asp:RequiredFieldValidator id="rfvDescription_Edit" runat="server" Text="Required" ControlToValidate="txtCycleDescription"
> Display="Dynamic"></asp:RequiredFieldValidator>
> </EditItemTemplate>
> </asp:TemplateColumn>
> <asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" HeaderText="Edit" CancelText="Cancel"
> EditText=" Edit ">
> <ItemStyle CssClass="Buttons"></ItemStyle>
> </asp:EditCommandColumn>
> <asp:TemplateColumn>
> <FooterTemplate>
> <asp:Button id="btnAddNew" Width="100%" CssClass="Buttons" Text="Add" Runat="server" CommandName="ADD_NEW"></asp:Button>
> </FooterTemplate>
> </asp:TemplateColumn>
> </Columns>
> </asp:datagrid></form>
>
>
> Thanks in advance!
>
> Steve Kallal
>
|