Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i hav use autogenerate adit link in gridview.i have write code that ,when i click on edit link data on that line comes in textbox.here is my code.
int Editid =Convert.ToInt16(GridView1.DataKeys[e.NewEditIndex].Values[0].ToString());
           objdal.Editid=Editid;
           dv=objdal.Edit_Data();

           ddlGroupName.SelectedValue= dv.Table.Rows[0]["Groupid"].ToString();
           ddlName.SelectedValue = dv.Table.Rows[0]["Name"].ToString();
           txt_LeaveFrom.Text = dv.Table.Rows[0]["LeaveFrom"].ToString();
           txt_LeaveTo.Text = dv.Table.Rows[0]["LeaveTo"].ToString();

Edit_data() function.....

public DataView Edit_Data()
{

    cmd = new SqlCommand("LeaveForm_Select_Data", cnn);
    cmd.CommandType = CommandType.StoredProcedure;


    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();
    da.Fill(ds);

    DataView dv = new System.Data.DataView();
    dv.Table = ds.Tables[0];
    return dv;




}



when i click on edit datacomes in textbox.but when i click on other edit link at the same time,Update and Cancle link autometicaly genrate at row which i have click first one.
what is solution for that.
Posted

1 solution

Hi check this link


and go to "Get Code for this sample.." link there you can get the clear picture

Row edit[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900