Murugan.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



asp .net repeater control pass commandargument OnItemCommand

Home   ASP.NET   asp .net repeater control pass commandargument OnItemCommand         


I wanted to delete a row from a table. The table I was displaying using a repeater control . So when the 
user clicks on delete I needed to pass a 

Here's the code that works. 

<asp:Repeater ID="Repeater1" runat="server" OnItemCommand="Proc_ItemCommand" >

<asp:ImageButton ID="btnDelete" CommandName="Delete" CommandArgument='<%#(Container.DataItem("NotesID"))%>' ImageUrl="images/deletebin.jpg" runat="server" /> 

Public Sub Proc_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)
        Select Case e.CommandName
            Case "Delete"
                Dim oDataSet As New DataSet
                Dim oNotes As New cNotes
                oNotes.Notesid = e.CommandArgument
                oNotes.Delete()
                FillRepeater()
End Select

I needed notesId  the datakey so that I could pass it as a primary key while deleting. The Above code I guess is self explanatory.







  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam