Skip to content

Commit

Permalink
Repro for postback handler binding translation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasherceg committed Oct 26, 2024
1 parent 0df5117 commit 468a7ce
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DotVVM.Framework.ViewModel;
using DotVVM.Framework.Hosting;

namespace DotVVM.Samples.Common.ViewModels.FeatureSamples.PostBack
{
public class PostBackHandlerBindingViewModel : DotvvmViewModelBase
{
public bool Enabled { get; set; } = false;

public int Counter { get; set; } = 0;

public string[] Items { get; set; } = new string[] { "Item 1", "Item 2", "Item 3" };
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@viewModel DotVVM.Samples.Common.ViewModels.FeatureSamples.PostBack.PostBackHandlerBindingViewModel, DotVVM.Samples.Common

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>

<p>
<dot:CheckBox Text="Suppress postbacks" Checked="{value: Enabled}" />
</p>
<p>Counter: {{value: Counter}}</p>

<p>Click on grid rows to increment the counter.</p>

<dot:GridView DataSource="{value: Items}">
<Columns>
<dot:GridViewTextColumn HeaderText="Column 1" ValueBinding="{value: _this}" />
</Columns>
<RowDecorators>
<dot:Decorator Events.Click="{command: _parent.Counter = _parent.Counter + 1}" style="cursor: pointer">
<PostBack.Handlers>
<dot:SuppressPostBackHandler Suppress="{value: _parent.Enabled}" />
</PostBack.Handlers>
</dot:Decorator>
</RowDecorators>
</dot:GridView>

</body>
</html>


0 comments on commit 468a7ce

Please sign in to comment.