[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

OnItemCommand for deleting a row

Posted on 2012-04-04
1
Medium Priority
?
225 Views
Last Modified: 2012-04-05
This should work but i dont know why it's not.

I have a listview like this;
 
<asp:ListView ID="lvOutgoing" 
                 OnSelectedIndexChanging="lvOutgoing_SelectedIndexChanging"
                OnItemCommand =   "lvOutgoing_ItemCommand" 
                 
              runat="server">

Open in new window


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>

Open in new window


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");
           .....

       }

        
    }
          

Open in new window


But I get an error that onItemdeleting is not being handled. So, I added this:

OnItemDeleting=  "lvOutgoing_OnItemDeleting" 

Open in new window


And the event:
 protected void lvOutgoing_OnItemDeleting(object sender, ListViewDeleteEventArgs e)
    {
       }

Open in new window


But now I dont know how to find the row I click on. How can I do this?
0
Comment
Question by:Camillia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 21

Accepted Solution

by:
masterpass earned 2000 total points
ID: 37809477
you can get it like this

protected void lvOutgoing_OnItemDeleting(object sender, ListViewDeleteEventArgs e)
{
var item = lvOutgoing.Items[e.ItemIndex];
//do what ever you want with this item
}

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question