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
Mohamed Somalia
NA
312
3.5k
Gridview Problem
Feb 27 2017 4:32 AM
Helo, i want to update Gridview Asp.net using C# Date not Updated please Help
///Gridview///
<asp:GridView ID="GridView1" runat="server" DataKeyNames="ID"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
onrowupdating="GridView1_RowUpdating" onrowupdated="GridView1_RowUpdated">
<Columns>
<asp:CommandField ShowEditButton ="true" />
<asp:CommandField ShowDeleteButton= "true" />
</Columns>
</asp:GridView>
///GridView Updating Code///
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
String ID = GridView1.Rows[e.RowIndex].Cells[0].Text;
String ClassName = GridView1.Rows[e.RowIndex].Cells[1].Text;
obj.con.Open();
obj.qry = "update Classreg set ClassName=@ClassName where ID=@ID";
obj.cmd = new SqlCommand(obj.qry, obj.con);
obj.cmd.Parameters.AddWithValue("ClassName", TextBox2.Text);
obj.cmd.Parameters.AddWithValue("ID", TextBox1.Text);
obj.cmd.ExecuteNonQuery();
obj.con.Close();
Response.Write(@"<script language='javascript'>alert('Record Updated.')</script>");
filldata();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
filldata();
}
Reply
Answers (
7
)
How to Calculate Decimal values of All Rows From a Table in
Activation error occured