解决方法
它可能与您有所不同(取决于您具有编辑,删除,选择按钮的位置).我添加了一个gridview,并在第一列中有Buttons.然后我在RowDataBound事件中添加了这个:
protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DaTarow) { LinkButton lbedit = (LinkButton)e.Row.Cells[0].Controls[0]; lbedit.Text = "<img src='https://www.google.com/logos/classicplus.png' />"; //There is a literal in between LinkButton lbDelete = (LinkButton)e.Row.Cells[0].Controls[2]; lbDelete.Text = "<img src='https://www.google.com/logos/classicplus.png' />"; //There is a literal in between LinkButton lbSelect = (LinkButton)e.Row.Cells[0].Controls[4]; lbSelect.Text = "<img src='https://www.google.com/logos/classicplus.png' />"; } }
祝好运!