I have a function for which i am sharing a group of link buttons with. the function signature is like:
protected void FunctionName(object sender, EventArgs e)
{
 ...
}
Now I have about 4-5 link buttons which i am using to call the same function but just filtering the stuff via command argument like:
<asp:LinkButton ID="lbAll" runat="server" Text="All"
                        CommandArgument="all" OnClick="FunctionName"></asp:LinkButton>
<asp:LinkButton ID="lbTop" runat="server" Text="Top" 
                        CommandArgument="top" OnClick="FunctionName"></asp:LinkButton>
(...)
Now, I have a drop down box which needs to do the same thing essentially (on just two of the selected values), i just need to call this function and pass the "all" or "top" argument to the Function: "FunctionName"
this is in C#
I tried to call that function like
FunctionName(this, New EventArgs());
but I dont know how to pass the Argument?
Any ideas on this? Thanks!
Pass the LinkButton with the correct CommandArgument instead of the this:
FunctionName(lbAll, EventArgs.Empty)
But you really should use the OnCommand event instead of OnClick. OnCommand has CommandEventArgs as second parameter. So you can get them with e.CommandArgument in the method. And call the method width:
FunctionName(this, new CommandEventArgs("CommandName", "CommandArgument"));
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With