|
|
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
'Like' us on our FaceBook page if you find this blog useful. Thanks!
Did you like this post?
|
|
|
||
|
|
|
|
Save on Delicious |
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |




comments
0 Responses to "Add an Image Command Field to a GridView at runtime"Post a Comment