Datagrid - How to format EditCommandColumn?

C

corndog

I have a Datagrid control with an edit command column, which has a
PushButton ButtonType.

I am trying to apply formatting to the button, to set the font-size and the
font name.

I have only been able to come up with the following...

<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit">
<HeaderStyle Width="10%"></HeaderStyle>
<ItemStyle Font-Names="Verdana" Font-Size="8pt"></ItemStyle>
</asp:EditCommandColumn>

This however applies formatting to the cell that the button is contained
in, not the button. Is there any way to do this?
 
H

Harolds

Use the datagrids ItemDataBound, below is a sample where I get the control
and change the text:
Private Sub grd_ItemDataBound(ByVal sender As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdIncidentSearch.ItemDataBound
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType =
ListItemType.AlternatingItem Then
Dim lnk As LinkButton = e.Item.FindControl("ControlName")
lnk.Text = "text"
End If
End Sub
 
C

corndog

But the EditCommandColumn does not have an "id" property for its button so I
don't believe the FindControl method can be used.
 
H

Harolds

Use a template column

corndog said:
But the EditCommandColumn does not have an "id" property for its button so I
don't believe the FindControl method can be used.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top