我已經使用gridview中的templete字段刪除按鈕,所以當我點擊gridview中的任何刪除按鈕以刪除一行時,它會使用該選定行的cells[0]
值給刪除行索引。我怎麼能做任何人有一個想法....?如何使用刪除按鈕獲得所選行索引和所選行的單元值
protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index = Convert.ToInt32(e.CommandArgument);
int grdid = Int32.Parse(GridView3.Rows[index].Cells[0].Text);
IndiesProductDataContext ip = new IndiesProductDataContext();
ip.iLinks.DeleteAllOnSubmit(ip.iLinks.Where(c => c.ProductID == grdid));
ip.SubmitChanges();
}
我在GridView中刪除行使用行命令歌廳指數,但它不工作
但我要刪除同一選定行,也希望刪除的另一個表值形式選擇中行的主單元格值... – dzsinh 2013-04-04 11:06:26
是的,你可以寫2在不同的sql命令變量的同一個sql連接下爲你的2個不同的記錄從不同的表中刪除查詢。 – 2013-04-04 11:10:00