0

I'm not sure the title makes best sense.

I'm trying to call a method which would usually be only accessible by direct clicks from the front page itself. However in one very particular instance I need to call this method the once, but as this method uses a Buttons CommandArgument to determine what it should do I need to get the CommandArgument of this fake button call.

I would usually call a method like so

Make_Profile(this, new EventArgs());

or

Make_Profile(null, null);

I have tried calling a method like so:

AddressPage(this, new EventArgs("CommandArgument", "1");

But I don't think I understood this piece of code well.

Within the Method I call:

argument = ((Button)sender).CommandArgument;

    if (string.IsNullOrWhiteSpace(argument))
    {
        numba = 0;
    }
    else
    {
        numba = Convert.ToInt32(argument);
    }

So hopefully you can see what I'm trying to get from Button.

  • dear it take two args (this represent the sender and , new eventargs represent the send data and in this case AddressPage(this, new EventArgs("CommandArgument", "1"); it represent that the eventargs have commandargument which value is 1 – Developerzzz Feb 17 '14 at 12:59
  • What do you mean with "Get the CommandArgument of this fake button call"? If it's fake, why don't you fake the commandargument as well? – Patrick Feb 17 '14 at 14:08
  • I don't know how to fake the commandArgument; so normally when I fake call a method that is normally called by a button, I would do 'methodname(null,null)' however as this new method is also dependent on the buttons CommandArgument I need a way to call the method with the CommandArgument –  Feb 17 '14 at 14:17

1 Answers1

0
Make_Profile(null, null);

work fine.

abrfra
  • 634
  • 2
  • 6
  • 24