Datagrid - How to format EditCommandColumn?

Discussion in 'ASP .Net Web Controls' started by corndog, Jun 14, 2005.

  1. corndog

    corndog Guest

    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?
    corndog, Jun 14, 2005
    #1
    1. Advertising

  2. corndog

    Harolds Guest

    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
    Harolds, Jun 14, 2005
    #2
    1. Advertising

  3. corndog

    corndog Guest

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

    "Harolds" wrote:

    > 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
    >
    corndog, Jun 14, 2005
    #3
  4. corndog

    Harolds Guest

    Use a template column

    "corndog" wrote:

    > But the EditCommandColumn does not have an "id" property for its button so I
    > don't believe the FindControl method can be used.
    >
    > "Harolds" wrote:
    >
    > > 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
    > >
    Harolds, Jun 14, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick
    Replies:
    1
    Views:
    469
    Richard Ryerson
    Feb 2, 2004
  2. Richard Ryerson
    Replies:
    0
    Views:
    2,627
    Richard Ryerson
    Jan 28, 2004
  3. Piotr
    Replies:
    0
    Views:
    409
    Piotr
    Jan 6, 2006
  4. Scott McDaniel

    Reference Datagrid EditCommandColumn In Code

    Scott McDaniel, Mar 29, 2006, in forum: ASP .Net
    Replies:
    6
    Views:
    4,543
    Steven Cheng[MSFT]
    Apr 3, 2006
  5. corndog

    Format Pushbutton in EditCommandColumn of DataGrid

    corndog, Jun 8, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    139
    corndog
    Jun 8, 2005
Loading...

Share This Page