gridview中获得checkbox选中的行号和另外几种情况获得行号

it2022-05-05  116

Code   protected void CheckBox1_CheckedChanged(object sender, EventArgs e)    {        //Response.Write("<script>alert('" + ((CheckBox)sender).ToolTip + "');</script>");        GridViewRow gvr = (GridViewRow)((CheckBox)sender).Parent.Parent;        string indexa = GridView1.DataKeys[gvr.RowIndex].Value.ToString();    } Code //自定义模板编辑时if(e.CommandName == "domnload"){   int rowindex = ((GridViewRow)((LinkButton)e.CommandSourece).NamingContainer).RowIndex;   string id = GridView.DataKey[rowIndex].Value.Tostring();     //dosomething}

转载于:https://www.cnblogs.com/renjuwht/archive/2009/07/15/1523760.html


最新回复(0)