If you were looking out to programmatically add an Image Command Field to a GridView, here’s how to do so:
C#
if (!Page.IsPostBack)
{
CommandField field = new CommandField();
field.ButtonType = ButtonType.Image;
field.SelectImageUrl = "~/Images/MyPic.GIF";
field.ShowSelectButton = true;
field.HeaderText = "Select";
GridView1.Columns.Add(field);
GridView1.DataBind();
}
VB.NET
If (Not Page.IsPostBack) ThenTo check out some more GridView tips, look over here ASP.NET GridView Tips and Tricks
Dim field As New CommandField()
field.ButtonType = ButtonType.Image
field.SelectImageUrl = "~/Images/MyPic.GIF"
field.ShowSelectButton = True
field.HeaderText = "Select"
GridView1.Columns.Add(field)
GridView1.DataBind()
End If
Tweet
No comments:
Post a Comment