This is a migrated thread and some comments may be shown as answers.

Listview selection noob (How to select and delete?)

3 Answers 58 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Iron
Paul asked on 22 Feb 2012, 08:29 PM
Much as I enjoy the hunt for what I'm missing I hope someone out there will take pity on me and help me along the learning curve ;)
I have a listview databound to a LINQ query and all works fine.  I need the user to be able to select an item, by clicking on it's icon and deleting it.  So, in my ASPX I have this:

<asp:ImageButton ID="categoryImageBtn" OnClick="categoryBtn_Click" CommandName="Select" Height="30" Width="50" runat="server" ImageUrl='<%# Eval("ImagePath") %>' />

And in my codebehind I have this:

 

protected void myProjectListView_ItemCommand(object sender, RadListViewCommandEventArgs e)

{
if (e.CommandName == RadListView.SelectCommandName)

{

Label2.Text = "Bingo";
}
}

Just to see if it's working and needless to say... no luck :(  I know the button works, as I wired up an onCLick event that fires fine.

 

I've tried various approaches in the tutorials with no luck. 

 

I'd be very very grateful if someone could take a moment to point me in the right direction!

 

Paul

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3 Answers, 1 is accepted

Sort by
0
Paul
Top achievements
Rank 1
Iron
answered on 23 Feb 2012, 06:19 PM
Got it... was a databinding issue which I found buried in another thread.  Moved my databinding into the "needsData" event and worked like a charm.  I read a number of people with the same problem so hopefully this helps someone.
0
Stephan
Top achievements
Rank 1
answered on 21 Mar 2012, 09:35 PM
You should have had a link to the one that helped you out.

Still looking.
0
Paul
Top achievements
Rank 1
Iron
answered on 21 Mar 2012, 09:39 PM
Try what I did, and perform your databinding in the "needsData" event handler...
Tags
ListView
Asked by
Paul
Top achievements
Rank 1
Iron
Answers by
Paul
Top achievements
Rank 1
Iron
Stephan
Top achievements
Rank 1
Share this question
or