[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

deleting a record

Posted on 2011-09-16
8
Medium Priority
?
240 Views
Last Modified: 2012-05-12
I d like to delete a row from my listview. I have added/placed the itemtemplate"Remove" with javascript to alert before deleting. I have a stored proc to delete the record passing the Id too.
However I could not get the Id in that row of the record to delete. I place code in listview itemcomnad event. how to get the id using datakeys ?
0
Comment
Question by:zachvaldez
[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
  • 4
  • 4
8 Comments
 
LVL 60

Expert Comment

by:HainKurt
ID: 36552404
post code for your template and code for ListView_ItemCommand
0
 
LVL 60

Expert Comment

by:HainKurt
ID: 36552413
maybe this way

ListViewDataItem dataItem = (ListViewDataItem)e.Item;
string ID = ListView.DataKeys[dataItem.DisplayIndex].Value.ToString();
DeleteRecord(ID);
0
 
LVL 60

Accepted Solution

by:
HainKurt earned 1000 total points
ID: 36552418
VB

Dim dataItem As ListViewDataItem = CType(e.Item, ListViewDataItem)
Dim ID As String = ListView.DataKeys(dataItem.DisplayIndex).Value.ToString()
DeleteRecord(ID)

add these codes into ListView_OnItemCommand event...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:zachvaldez
ID: 36553872
I think I saw this code already and tried to implement it and I was getting error in something like converting string to type integer. Ill have to confirm to you Monday since I don't have VS 2010 on my PC.
0
 

Author Comment

by:zachvaldez
ID: 36560535
I tried it and I get the error

'Object reference not set to an instance of an object.'
0
 

Author Comment

by:zachvaldez
ID: 36560890
Ok it worked now. I just need to refesh the page after deleting so it shows the item isnt there. thanks
0
 
LVL 60

Expert Comment

by:HainKurt
ID: 36560971
call BindData to refresh the data...
0
 

Author Comment

by:zachvaldez
ID: 36561239
absolutely! thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 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