public partial class Gridvw_expt2 : System.Web.UI.Page
{
SqlCommand com;
SqlDataAdapter da;
DataSet ds;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["gj"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
com = new SqlCommand("Select * from tblExpt",con);
da = new SqlDataAdapter(com);
ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows[0] != null)
{
GridView1.AutoGenerateEditButton = true;
GridView1.DataSource = ds;
GridView1.DataBind();
GridView1.RowUpdating += new GridViewUpdateEventHandler(abc);
GridView1.DataKeyNames = new string[] { "id" };
GridView1.RowEditing += new GridViewEditEventHandler(bc);
}
else
Response.Write("fkj");
}
protected void abc(object sender, GridViewUpdateEventArgs e)
{
Response.Write(e.RowIndex);
}
protected void bc(object sender, GridViewEditEventArgs e)
{
GridView gv = (GridView)sender;
gv.EditIndex = e.NewEditIndex;
}
}
次の行を編集する場合にのみ、編集モードで取得するために使用される行は、最初の行が編集モードでは決して取得されないことを意味します。イベントを動的に更新するgridviewを作成するにはどうすればよいですか?
正確なコンパイルメッセージ? –
GridView 'GridView1'発生したイベントRowEditingが処理されていません – Learner