|
-
Aug 23rd, 2005, 12:30 AM
#1
Thread Starter
Lively Member
Calling function in hyperlink?
Hello,
I want to call my delete function after clicking the delete hyperlink of my grid. is this possible? how?
Thanks
-
Aug 23rd, 2005, 01:06 AM
#2
Re: Calling function in hyperlink?
You can handle the hyperlink's click in the DataGrid's ItemCommand event. Based upon the Item and ItemIndex of the hyperlink clicked, you can perform the corresponding delete/delete function.
-
Aug 23rd, 2005, 01:25 AM
#3
Thread Starter
Lively Member
Re: Calling function in hyperlink?
 Originally Posted by mendhak
You can handle the hyperlink's click in the DataGrid's ItemCommand event. Based upon the Item and ItemIndex of the hyperlink clicked, you can perform the corresponding delete/delete function.
mendhak,
can you give me a sample script?
Thanks
-
Aug 23rd, 2005, 02:13 AM
#4
Re: Calling function in hyperlink?
Your template column will look like this:
Code:
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="hyl1" Runat="server">mylink</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
A linkbutton can be handled server side, so in the itemcommand event of the datagrid:
VB Code:
Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles DataGrid1.ItemCommand
Response.Write("Index: " & e.Item.ItemIndex.ToString())
End Sub
-
Aug 23rd, 2005, 02:33 AM
#5
Thread Starter
Lively Member
Re: Calling function in hyperlink?
-
Aug 23rd, 2005, 02:38 AM
#6
Re: Calling function in hyperlink?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|