• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 500
  • Last Modified:

How to pass 2 arguments from a linkbutton

Hi

I have the following line that fires a subroutine when the link is clicked;

  <asp:LinkButton runat="server" OnCommand="getMessage" CommandArgument='<%# Eval("messageID") %>' Text='<%# Eval("subject") %>' />

I need to pass an extra argument to the sub in addition to the current Eval("messageID") , in the form of Eval("messageStatus")

Can anyone provide any info on the most convenient method of achieving this?  Will I need to make any changes to the way the subroutine is written?

Sub getMessage(ByVal sender As Object, ByVal e As CommandEventArgs)
0
Rouchie
Asked:
Rouchie
  • 3
  • 2
1 Solution
 
here4u247Commented:
how about if you use the command name

<asp:LinkButton runat="server" OnCommand="getMessage" CommandArgument='<%# Eval("messageID") %>' CommandName=' Eval("messageStatus")' Text='<%# Eval("subject") %>' />

hope that helps,

AM
0
 
RouchieAuthor Commented:
Hi AM

Thanks for the post.  That's one approach I did consider but it might make things a little messy as the functionality grows.  Maybe in a few days I might even need to pass 3 arguments, so was looking for an extensible (and convenient) method to do this!
0
 
here4u247Commented:
ok, you can also pass an arraylist onto the CommandArgument or any data structure you prefer..

AM
0
 
RouchieAuthor Commented:
Thought that might be the obvious choice.  Thank you!
0
 
here4u247Commented:
you welcome
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now