VADIM
Mar 31, 2021, 2:17 PM
I use Ext.Net Razor Pages template project.
The server code Label lbl = this.GetCmp<Label>("lbl") returns label object.
But label's Text and Html properties are just empty strings ("").
However assignment lbl.Text = "some string"; works fine.
The code for Ext.Net Razor Pages:
Vew
@page "{handler?}"
@model ExtDemo1.Pages.DirectEventsModel
@{
ViewData["Title"] = "DirectEvent";
var X = Html.X();
}
<ext-section target="Main">
<ext-container region="Center" scrollable="true" paddingAsString="30 20 30 50">
<content>
<h1>DirectEvent</h1>
<ext-button text="Click Direct" onDirectClick="ButtonClick" />
<ext-label id="lbl" text="ext-label"></ext-label>
</content>
</ext-container>
</ext-section>
Controller
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Ext.Net;
using Ext.Net.Core;
using MojeeIO;
namespace ExtDemo1.Pages
{
public class DirectEventsModel : PageModel
{
public void OnGet()
{
}
public IActionResult OnPostButtonClick(string message = "default text")
{
Label lbl = this.GetCmp<Label>("lbl");
var txt = lbl.Text; // returns empty string
lbl.Text = $"{txt} {message}"; // works fine
return this.Direct();
}
}
}
The server code Label lbl = this.GetCmp<Label>("lbl") returns label object.
But label's Text and Html properties are just empty strings ("").
However assignment lbl.Text = "some string"; works fine.
The code for Ext.Net Razor Pages:
Vew
@page "{handler?}"
@model ExtDemo1.Pages.DirectEventsModel
@{
ViewData["Title"] = "DirectEvent";
var X = Html.X();
}
<ext-section target="Main">
<ext-container region="Center" scrollable="true" paddingAsString="30 20 30 50">
<content>
<h1>DirectEvent</h1>
<ext-button text="Click Direct" onDirectClick="ButtonClick" />
<ext-label id="lbl" text="ext-label"></ext-label>
</content>
</ext-container>
</ext-section>
Controller
using System;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Ext.Net;
using Ext.Net.Core;
using MojeeIO;
namespace ExtDemo1.Pages
{
public class DirectEventsModel : PageModel
{
public void OnGet()
{
}
public IActionResult OnPostButtonClick(string message = "default text")
{
Label lbl = this.GetCmp<Label>("lbl");
var txt = lbl.Text; // returns empty string
lbl.Text = $"{txt} {message}"; // works fine
return this.Direct();
}
}
}