DataKeyNames
生活随笔
收集整理的這篇文章主要介紹了
DataKeyNames
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
GridView的DataKeyNames屬性設為"ID,Name"GridView1.DataKeyNames = new string[]{ "ID","Name" };
列中LinkButton的CommandName屬性設為"Delete"
就可以在GridView1_RowDeleting中寫代碼:
DataKey key = GridView1.DataKeys[e.RowIndex];int id = int.Parse(key[0].ToString());//得到id字段值string name = key[1].ToString();//得到name字段值
列中LinkButton的CommandName屬性設為"Delete"
就可以在GridView1_RowDeleting中寫代碼:
DataKey key = GridView1.DataKeys[e.RowIndex];int id = int.Parse(key[0].ToString());//得到id字段值string name = key[1].ToString();//得到name字段值
轉載于:https://www.cnblogs.com/top5/archive/2010/05/06/1728768.html
總結
以上是生活随笔為你收集整理的DataKeyNames的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Enterprise Library 5
- 下一篇: 遍历一个类中的每一个属性、方法、公共字段