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)
LVL 25
RouchieAsked:
Who is Participating?
 
here4u247Connect With a Mentor Commented:
ok, you can also pass an arraylist onto the CommandArgument or any data structure you prefer..

AM
0
 
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
 
RouchieAuthor Commented:
Thought that might be the obvious choice.  Thank you!
0
 
here4u247Commented:
you welcome
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.