Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use System.Web.UI.WebControls.DataListItemEventArgs

Status
Not open for further replies.
Apr 3, 2005
32
US
I have a linkbutton in the datalist <EditItemTemplate> to call a sub function.
Example of my code:
<asp:LinkButton ID="Linkbutton5" Text="Multi" Onclick="CallIndividual" Runat="server"></asp:LinkButton></td>

In the code behind page, I have the function CallIndividual as follow:

Sub CallIndividual(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlCorrection.ItemDataBound
Dim txtID As TextBox = e.Item.FindControl("GLID")
End Sub

I want to grab that selected ID control & save it into txtID.

But when I run it, it gave me the following error message:

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30408: Method 'Public Sub CallIndividual(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs)' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.


Any suggestion is greatly appreciated.
Thank you!
 
<asp:LinkButton ID="Linkbutton5" Text="Multi" Onclick="CallIndividual" CommandArgument='<%# DataBinder.Eval(Container.DataItem("GLID"))%>' Runat="server"></asp:LinkButton></td>


Public Sub CallIndividual(ByVal sender As Object, ByVal e As EventArgs)

Dim GLID as string=ctype(sender,linkbutton).commandargument

End Sub
 
Thank you very much, everything is working except I have to change one minor detail, which is:
CommandArgument='<%# Container.DataItem("ID")%>'

Again, you are a life saver.
Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top