日期:2014-05-19  浏览次数:20438 次

Gridview中点击小图标“编辑”时,跳转到另外一个页面编辑
Gridview中点击小图标“编辑”时,跳转到另外一个页面编辑

以下是一个显示“修改”的HyperLinkField,点击时跳转到BulletinModify.aspx?bulletinID={0},
可以在BulletinModify.aspx中修改本条记录。
---------------------------
  <asp:HyperLinkField   DataNavigateUrlFields= "ID_NonPersonnel "   DataNavigateUrlFormatString= "NonPersonnel.aspx?ID_NonPersonnel={0} "DataTextFormatString= "修改 "   HeaderText= "修改 "   Text= "修改 "> <ItemStyle   Height= "20px "   HorizontalAlign= "Center "   />
  <HeaderStyle   CssClass= "GridBK "   /> </asp:HyperLinkField   >

以下是一个用两个小图标分别显示编辑和删除的CommandField,想要实现点击“编辑”图标时,跳转到BulletinModify.aspx?bulletinID={0},可以在BulletinModify.aspx中修改本条记录。请问如何实现?
----------------------
<asp:CommandField   ShowDeleteButton= "True "   ButtonType= "Image "   CancelText= " "   DeleteText= "Delete "   EditText= "Edit "   SelectText= " "   ShowHeader= "True "   SortExpression= "ID_NonPersonnel "   ShowEditButton= "True "   CancelImageUrl= "~/Images/icon-cancel.gif "   DeleteImageUrl= "~/Images/icon-delete.gif "   EditImageUrl= "~/Images/icon-edit.gif "   SelectImageUrl= "~/Images/icon_left_white_arrow.gif "   UpdateImageUrl= "~/Images/icon-save.gif "   UpdateText= " "   >
<FooterStyle   HorizontalAlign= "Center "   />
  <HeaderStyle   Width= "20px "   />
<ItemStyle   Width= "50px "   />
  </asp:CommandField>

------解决方案--------------------
如果是vs2005的话,非常简单的啊!只要用鼠标操作几下就可以实现了,一行代码也不需要写。呵呵
那个HyperLink可能有一个参数,那就是target=_blank
------解决方案--------------------
使用HyperLinkField
------解决方案--------------------
<asp:HyperLinkField DataNavigateUrlFields= "字段 " DataNavigateUrlFormatString= "xx.aspx?变量={0} "
HeaderText= "编辑 " Text= "编辑 " />
然后你要在xx.aspx页面接受这个值
private string BID;
private int strID
{
get
{
return Convert.ToInt32(ViewState[ "_BID "]);
}
set
{
ViewState[ "_BID "] = Request.QueryString[ "BID "];
}
}
然后在根据bid更新数据库
------解决方案--------------------
设置一个属性?这种方法还是第一次见,受教。

可是这样的话怎么获得呢?转入这个页面就会自己获得了吗?
------解决方案--------------------
在RowCommand事件里判断跳转啊
------解决方案--------------------
接分
------解决方案--------------------
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
Response.Write( " <script> Window.open( 'hhhhh.aspx?id= " + GridView1.DataKeys[e.NewEditIndex].Value + " '); </script> ");
}
------解决方案--------------------

------解决方案--------------------
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)