TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sun Light
NA
54
7.3k
How to update values in textboxes from gridview using ID
Jul 7 2017 10:40 AM
Hi all!
How can i update the values in textboxes from gridview using ID(Primary Key).
Below is my gridview code..
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" SelectedRowStyle-BackColor="#ccff99" AutoGenerateSelectButton="True">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField DataField="EmpID" HeaderText ="ID" />
<asp:BoundField dataField="FirstN" HeaderText="FirstN" />
<asp:BoundField DataField="LastN" HeaderText="LastN" />
<asp:BoundField DataField="Gender" HeaderText="Gender" />
<asp:BoundField DataField="Address" HeaderText="Address" />
<asp:BoundField DataField="Salary" HeaderText="Salary" />
<asp:BoundField DataField="Jdate" HeaderText="Jdate" />
</Columns>
here is my update query--
SqlCommand cmd1 = new SqlCommand("Update tblCRUD set values FirstN='" + TextBox1.Text + "',LastN='" + TextBox2.Text + "',Gender='" + gender + "',Address='" + TextBox3.Text + "',Salary='" + TextBox4.Text + "',Jdate='" + TextBox5.Text + "' where EmpID=?, con1");
cmd1.CommandType = CommandType.Text;
if (con1.State == ConnectionState.Closed)
{
con1.Open();
cmd1.ExecuteNonQuery();
clear();
}
how to pass the EmpID value?
Thanks..
Reply
Answers (
1
)
Can we have same name for more than one entity class?
How to assign html textbox value from code behind using c# ?