Click here to Skip to main content
15,897,151 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to write the code for editing in .cs file how would i write that
I i do the coding in html it is working in that case no server side coding is required

C++
SqlConnection con= new SqlConnection(@"Data Source=SPIL279\SQLEXPRESS;Initial Catalog=kamal_webapplicatins;Integrated Security=True;");
string @userid;
string @password;

protected void Page_Load(object sender, EventArgs e)
{
    string quary ="select UserId,Password from Regstration";
                //InsertCommand="INSERT INTO [Regstration] ([UserId], [User_First_Name], [User_Last_Name], [Password], [DateOfBirth], [Password_Question], [Password_Answer], [Mobile_no], [email]) VALUES (@UserId, @User_First_Name, @User_Last_Name, @Password, @DateOfBirth, @Password_Question, @Password_Answer, @Mobile_no, @email)"
    SqlDataAdapter da = new SqlDataAdapter(quary, con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    gridview3.DataSource = ds.Tables[0];
    gridview3.DataBind();
}
protected void edit_click(object sender, EventArgs e)
{
    string update_quary = "update Regstration set password =@password where userud=@userid";
    SqlDataAdapter da = new SqlDataAdapter(update_quary, con);
    DataSet ds = new DataSet();
    da.Fill(ds);
}


/head>
  <removed id="form1" runat="server">
  <div>
  </div>
  <asp:removed id="gridview3" runat="server" xmlns:asp="#unknown">
    
  <asp:removed>
    
  <asp:removed id="btnEdit" runat="server" text="Edit" onclick="edit_click" causesvalidation="false" />
    
  </asp:removed>
  <asp:removed showeditbutton="true" showdeletebutton="true" showinsertbutton="true" /> 
  </asp:removed>
Posted
Updated 19-Apr-10 1:41am
v4

1 solution

There are number of articles on this very site for editing gridview.
Edit Individual GridView Cells in ASP.NET[^]
Editable Nested GridView (All-in-One)[^]
Paging, Selecting, Deleting, and Editing in the ASP.NET 2.0 GridView Control with Keyboard Shortcuts[^]
Have a look at them. Can get more, just go through published articles.
 
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