當前位置:編程學習大全網 - 行動軟體 - 關於CommandArgument綁定gridview字段的問題。

關於CommandArgument綁定gridview字段的問題。

<asp:linkbutton id="btn1" CommandArgument='<%# Eval("ID")%>'></asp:linkbutton>

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)

{

if (e.CommandName.ToString() == "se")

{

LinkButton myL = (LinkButton)e.CommandSource;

int Index = ((GridViewRow)(myL.NamingContainer)).RowIndex;//獲得行號

string id = GridView1.DataKeys[Index].Value.ToString();//獲得id

}

}

  • 上一篇:驚慌失措的意思是什麽
  • 下一篇:pot-al00a是什麽型號?
  • copyright 2024編程學習大全網