Home General

Replaced OnDemand Links don't always work if displayed more than once.

I have a script which contains links to execute an external program and then replaces the link with another link to display the results. The initial link always works, but sometimes the replaced link would not work.
From debugging, it looks like if the replaced link is displayed twice, the first link does not work.

The following program illustrates the issue

void Main(string[] args)
{
    Util.KeepRunning();

    var array = new Test[] { new Test("A"), new Test("B")};

    array.Dump();
    array.Skip(1).Dump();
}


public class Test
{
    public string Name ;
    public DumpContainer Link;

    public Test(string name)
    {
        this.Name = name;
        Link = Util.OnDemand<DumpContainer>("DoIt", () => DoIt(this));
    }

    DumpContainer DoIt(Test rs)
    {
        return Util.OnDemand("Click here to see results", () =>
        {
            return "The Results";
        });

    }
}

Run the script and click on the two links in the first grid and they both work correctly.

The replaced link works for A but not for the B in the first grid and the status line just says 'Executing action ...'
The replaced link for B in the second grid does work.

Now I know what causes this, I can work around it by scrolling down to find the last link for that record which will work.

Sign In or Register to comment.