欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

datagrid行内按钮(更新/删除等)操作实现代码

程序员文章站 2024-03-04 22:18:48
ui: 复制代码 代码如下: <...
ui:
复制代码 代码如下:

<asp:templatefield headertext="operation" showheader="false">
<itemstyle width="100px" />
<itemtemplate>
<table width="100%">
<tr>
<td align="center" valign="middle">
<asp:imagebutton id="imgupdate" commandname="update" tooltip="update" imageurl="~/app_themes/images/edit.png"
runat="server" />
<%--<a href="applicationdetail.aspx?type=update&applicationid=<%#eval("applicationid") %>">
<img style="border: 0" width="12" height="12" alt="update" src="../themes/images/edit.png" /></a>--%>
</td>
<td align="center" valign="middle">
  
<asp:imagebutton id="imgdelete" commandname="delete" tooltip="delete" imageurl="~/app_themes/images/del.png"
runat="server" />
</td>
</tr>
</table>
</itemtemplate>
</asp:templatefield>

复制代码 代码如下:

<asp:templatefield headertext="view">
<itemtemplate>
<a href="draftvesselorderdetail.aspx?serviceid=<%#eval("number") %>&tripselectedindex= <%# container.dataitemindex %>">
<img style="border: 0" alt="view" src="../../app_themes/images/preview.gif" /></a>
</itemtemplate>
</asp:templatefield>

code:
复制代码 代码如下:

protected void gdvorderlist_rowcommand(object sender, gridviewcommandeventargs e)
{
switch (e.commandname.tolower())
{
case "view":
var serviceid = long.parse(e.commandargument.tostring());
response.redirect("draftorderdetail.aspx?type=view&serviceid=" + serviceid + "&frompage=order&gridpageindex=" + serviceid);
break;
}
}