|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid - How to format EditCommandColumn?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? 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 But the EditCommandColumn does not have an "id" property for its button so I
don't believe the FindControl method can be used. Show quoteHide quote "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 > Use a template column
Show quoteHide quote "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 > >
Custom Controls & Javascript
DataGrid with edititemtemplate What happened to Alignment property? Another basic question: How to call and show one Web Form from another Web Form? RadioButton in 2 GroupNames? ASP.net datagrid with more than 1 datasource SortCommand and custom headers - why won't they play nice? Odd Dropdownlist problem ListBox not firing SelectedIndexChanged (AutoPostBack=True) Panel limitations? |
|||||||||||||||||||||||