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
ANAY SHUKLA
NA
24
463
Delete from Repeator
Jan 19 2018 12:22 AM
protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e)
{
try
{
if (e.CommandName == "Del")
{
int paymentid = 0;
paymentid = Convert.ToInt32(((Label)rptlist.Items[0].FindControl("lblpaymentid")).Text);
SqlParameter[] Paramsdel = { new SqlParameter("@Mode","D"),
new SqlParameter("@paymentid",paymentid)
};
int Res = 0;
Res = JSQL.execStoredProcudure("sp_bank", Paramsdel);
if (Res > 0)
{
JRDMessage.UserMessage(this, "Data deleted Sucessfully ");
FillDetails();
bindDet();
}
}
}
catch (Exception ex)
{
}
}
This is my code i want to delete row from data using payment id but when ever i click on last row or middle row button for delete then it will deleted top row every time , how can i manage it.
Reply
Answers (
2
)
0
Ajeesh
0
268
41.9k
Jan 19 2018 12:32 AM
You can try with below code
protected
void
rptlist_ItemCommand(
object
source, RepeaterCommandEventArgs e)
{
try
{
if
(e.CommandName ==
"Del"
)
{
int
paymentid = 0;
//Change the code like below
//paymentid = Convert.ToInt32(((Label)rptlist.Items[0].FindControl("lblpaymentid")).Text);
Label lbl = e.Item.FindControl(
"lblpaymentid"
)
as
Label;
paymentid = Convert.ToInt32(lbl.Text);
SqlParameter[] Paramsdel = {
new
SqlParameter(
"@Mode"
,
"D"
),
new
SqlParameter(
"@paymentid"
,paymentid)
};
int
Res = 0;
Res = JSQL.execStoredProcudure(
"sp_bank"
, Paramsdel);
if
(Res > 0)
{
JRDMessage.UserMessage(
this
,
"Data deleted Sucessfully "
);
FillDetails();
bindDet();
}
}
}
catch
(Exception ex)
{
}
}
Accepted Answer
0
ANAY SHUKLA
0
24
464
Jan 19 2018 12:56 AM
Yes it is working .
Thanks a lot
Windows Form use in Asp.Net Page
Render different view in multiple tabs