Skip to content

GenerateClientPostbackLambda PostBackOptions inconsistency #1908

Open
@tomasherceg

Description

@tomasherceg

I noticed that the GenerateClientPostbackLambda method has an optional parameter of type PostBackOptions.

If the optional parameter is omitted, I would expect it would behave the same as when I pass new PostBackOptions() there, but there is a difference in its default values:

var expr = KnockoutHelper.GenerateClientPostbackLambda(prop, command, control);
// PostBackOptions.KnockoutBinding is used for the optional parameter, which is equivalent to this:
// new PostbackScriptOptions(elementAccessor: "$element", koContext: new CodeParameterAssignment("$context", OperatorPrecedence.Max, isGlobalContext: true))

var expr = KnockoutHelper.GenerateClientPostbackLambda(prop, command, control, new PostBackOptions());
// I believe this is suitable only for JS events, which I believe is quite a rare case used only in HtmlGenericControl

I think we can make the parameter mandatory to force the user to pass the correct PostBackOptions.
Also, I noticed that GridView and DataPager do not use the PostBackOptions.KnockoutBinding instance and create it themselves - I think we should reconsider that.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions