Click here to Skip to main content
11,703,632 members (70,717 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
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 31-Jan-13 18:38pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi check this link


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

Row edit[^]
  Permalink  

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

  Print Answers RSS
0 Maciej Los 570
1 OriginalGriff 500
2 Sergey Alexandrovich Kryukov 410
3 F-ES Sitecore 165
4 Andy Lanng 159
0 OriginalGriff 8,519
1 Sergey Alexandrovich Kryukov 7,667
2 CPallini 4,987
3 Maciej Los 4,686
4 Mika Wendelius 3,566


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 1 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100