BUTTON WITHIN GRIDVIEW

ok so i have a button within gridveiw
 <asp:Button ID="Button1" OnClick="delete" runat="server" Text="Delete" />

Open in new window


when its clicked i want to run my class
deletepost(url)

Open in new window


how can i do this ??

     Dim delete As Button = CType(e.Row.FindControl("Button1"), Button)
            Dim url As String = e.Row.DataItem("ID").ToString

Open in new window

runnerjp2005Asked:
Who is Participating?
 
dj_alikCommented:
0
 
HainKurtSr. System AnalystCommented:
something like this on GridView_RowCommand(..) event:

Dim index As Integer = Convert.ToInt32(e.CommandArgument)
' Retrieve the row that contains the button clicked
' by the user from the Rows collection.
Dim row As GridViewRow = ContactsGridView.Rows(index)
Dim url As String  = row.Cells(2).Text
deletepost(url)

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx
0
 
dj_alikCommented:
1.   public Queue<double>[] queues = new  Queue<double>[2];

2. Queue.Synchronized Method
http://msdn.microsoft.com/en-us/library/system.collections.queue.synchronized.aspx
0
 
dj_alikCommented:
oops
it's  not for for you
0
 
runnerjp2005Author Commented:
 Dim row As GridViewRow = ContactsGridView.Rows(index)

what does this do as i get ContactsGridView is not decleared

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.