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
Bineesh Viswanath
NA
1k
777.7k
ASP.NET GridView RowDeleting Event
Aug 20 2013 12:27 AM
Sir, I am in the program of asp.net gridView RowDeleteEvent .
I want your help in this event. I am showing SQL Sp to Default.aspx.cs.
1)SQL SP
ALTER PROCEDURE movieDelete
@movieId int
AS
delete from tbl_Movie where movieId=@movieId
RETURN
2)Default.aspx
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:LinkButton ID="lnkDelete" runat="server" CommandArgument='<%#Eval("movieid") %>'
CommandName="Delete">Delete</asp:LinkButton>
</ItemTemplate>
3) Default.aspx.cs
protected void dgvMovie_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int inId = Convert.ToInt32(dgvMovie.DataKeys[e.RowIndex].Value.ToString());
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlCommand c = new SqlCommand("moviedelete", sqlCon);
c.CommandType = CommandType.StoredProcedure;
c.Parameters.AddWithValue("@movieId", inId);
c.ExecuteNonQuery();
GridFill();
}
I getting either error nor output, just showing viewstate1.
Reply
Answers (
4
)
riw command event
help me