IDE: Microsoft Visual Studio Platform: C#.net
Hi, I am trying to add a custom button with image for a cell of gridview in c#.net, but not successful in achieving that. Any suggestions?
IDE: Microsoft Visual Studio Platform: C#.net
Hi, I am trying to add a custom button with image for a cell of gridview in c#.net, but not successful in achieving that. Any suggestions?
you can do it by two ways in gridview. 1 without css
<asp:TemplateField HeaderText="Test">
<ItemTemplate>
<asp:Button runat="server" ID="test" Text="upload" Style="background-color: green"/>
</ItemTemplate>
<FooterStyle />
<HeaderStyle />
<ItemStyle Width="30%" />
</asp:TemplateField>
2nd way, same code but replace the style attribute with CssClass="buttonBackground"
<asp:TemplateField HeaderText="Test">
<ItemTemplate>
<asp:Button runat="server" ID="test" Text="upload" CssClass="buttonBackground"/>
</ItemTemplate>
<FooterStyle />
<HeaderStyle />
<ItemStyle Width="30%" />
</asp:TemplateField>
.buttonBackground
{
background-image: url(../Images/backgroundImage.png);
background-repeat: repeat-x;
}