jglazer63
asked on
Resize button in button column
I have datagrid on my page with a button column in column (0) (pushbutton). I want to change the attributes of the button (font size, box color, etc). Can anyone help me figure out how to do this? The code below is from some research but it doesn't seem to make a difference. (articlelist is my datagrid).
Protected Sub articleList_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles articleList.ItemCreated
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then ' suppose the button in last column
Dim btn As Button = e.Item.Cells(0).Controls(0)
btn.Font.Name = "verdana"
btn.Font.Size = 10
End If
End Sub
ASKER
Nope, works for buttonlink not buttoncolumn. Give it a shot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It works with Itemcreated too.
Code it be that you missed the subtle changes in button layout or is it anything else with your code that crashes it?
Code it be that you missed the subtle changes in button layout or is it anything else with your code that crashes it?
<asp:DataGrid>
<Columns>
<asp:ButtonColumn ItemStyle-Font-Size="10" ItemStyle-Font-Names="Verd
</Columns>
</asp:DataGrid>