熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

gridview獲取主鍵的值

2022-06-13   來源: .NET編程 

  在 GridView_RowCommand中獲取主鍵的值

  protected void GridView_RowCommand(object sender GridViewCommandEventArgs e)

  {

  int OrderId = ConvertToInt(GridViewDataKeys[ConvertToInt(eCommandArgument)]Value); }

  在 GridView_PageIndexChanging中獲取主鍵的值

  protected void GridView_PageIndexChanging(object sender GridViewPageEventArgs e)

  {

  int index=GridViewDataKeys[eNewPageIndex]Value;

  }

  在 GridView_RowDeleting中獲取主鍵的值

  protected void GridView_RowDeleting(object sender GridViewDeleteEventArgs e)

  {

  int index=GridViewDataKeys[eRowIndex]Value;

  }

  在 GridView_RowEditing中獲取主鍵的值

  protected void GridView_RowEditing(object sender GridViewEditEventArgs e)

  {

  int index = GridViewDataKeys[eNewEditIndex]Value;

  }

  在 GridView_RowUpdating中獲取主鍵的值

  protected void GridView_RowUpdating(object sender GridViewUpdateEventArgs e)

  {

  int index = GridViewDataKeys[eRowIndex]Value;

  }

  在 GridView_RowDataBound中獲取主鍵的值

  protected void GridView_RowDataBound(object sender GridViewRowEventArgs e)

  {

  int index = GridViewDataKeys[eRowRowIndex]Value;

  }


From:http://tw.wingwit.com/Article/program/net/201311/13689.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.