Camillia
asked on
OnItemCommand for deleting a row
This should work but i dont know why it's not.
I have a listview like this;
This inside the listview;
And this to delete:
But I get an error that onItemdeleting is not being handled. So, I added this:
And the event:
But now I dont know how to find the row I click on. How can I do this?
I have a listview like this;
<asp:ListView ID="lvOutgoing"
OnSelectedIndexChanging="lvOutgoing_SelectedIndexChanging"
OnItemCommand = "lvOutgoing_ItemCommand"
runat="server">
This inside the listview;
<td><asp:LinkButton ID="EditButton" runat="Server" Text="Edit" CommandName="Select" /></td>
<td style="text-align:center" width="60" align="center"><div class="delete_bookmark_icon"><asp:LinkButton Text="Delete" CommandName="Delete" runat="server" ID="lbDelete"></asp:LinkButton> </div></td>
And this to delete:
protected void lvOutgoing_ItemCommand(object sender, ListViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
Label lblPatientId = (Label)e.Item.FindControl("lblrowId");
....
}
if (e.CommandName == "Delete")
{
Label lblPatientId = (Label)e.Item.FindControl("lblrowId");
.....
}
}
But I get an error that onItemdeleting is not being handled. So, I added this:
OnItemDeleting= "lvOutgoing_OnItemDeleting"
And the event:
protected void lvOutgoing_OnItemDeleting(object sender, ListViewDeleteEventArgs e)
{
}
But now I dont know how to find the row I click on. How can I do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.