# Practical Web Forms / Core guide

Component examples, matching parameters and adaptations for bindings, events and storage.

## Text and currency

Core uses decimal? for numbers. Web Forms accepts a decimal dot or comma; when both occur, the last separator identifies the decimal part. Required validation remains native and fields start in a neutral state.

### Web Forms

```aspx
<fs:FSTxtBox runat="server" TextoComponente="Nome" ValorComponente="Ana" Obrigatoria="true" />
<fs:FSCurrencyBox runat="server" ValorComponente="1250.50" />
```

### Core

```razor
<FSTxtBox TextoComponente="Nome" @bind-ValorComponente="nome" Obrigatoria />
<FSCurrencyBox @bind-ValorComponente="valor" />
@code {
    private string? nome = "Ana";
    private decimal? valor = 1250.50m;
}
```

## Multiple selection

OpcoesPT/OpcoesEN do not configure these controls. Web Forms uses Opcoes; Core provides OpcoesTexto or IReadOnlyList<FSOption>. OpcoesValores separates labels from internal values in controls that support it.

### Web Forms

```aspx
<fs:FSMultiSelectBox runat="server" TextoComponente="Areas"
    Opcoes="Financeiro;Comercial;Tecnologia"
    ValoresComponente="Tecnologia" />
```

### Core

```razor
<FSMultiSelectBox TextoComponente="Areas"
    OpcoesTexto="Financeiro;Comercial;Tecnologia"
    @bind-ValoresComponente="areas" />
@code {
    private IReadOnlyList<string> areas = ["Tecnologia"];
}
```

## Wizard and completion event

Import FSISA.Core.Models in the Razor file or _Imports.razor. Core receives RenderFragment and typed callbacks; textual OnClientFinish does not execute JavaScript in Core. Each step can receive its own EditContext and asynchronous validation.

### Web Forms

```aspx
<fs:FSWizard runat="server" Titulo="Cadastro"
    OnClientFinish="finalizarCadastro(); return false;">
  <fs:FSWizardStep runat="server" Titulo="Dados"
      Subtitulo="Identificacao" Icone="bi bi-person">...</fs:FSWizardStep>
</fs:FSWizard>
```

### Core

```razor
<FSWizard Titulo="Cadastro" Etapas="etapas" OnFinish="ConcluirAsync" />
@code {
    private readonly FSWizardStepDefinition[] etapas = [
        new("Dados", b => b.AddContent(0, "Preencha os dados."),
            Subtitle: "Identificacao", Icon: "bi bi-person")
    ];
    private Task ConcluirAsync() => Task.CompletedTask;
}
```

## Authorized upload

The Web Forms example delegates FSUpload.aspx to FSSecureFileUploadExampleHandler and requires an authenticated identity and session permission. Permission must come from a host decision, never a client parameter. The Core demo resolver requires an authenticated identity with NameIdentifier and isolates the root by user. Register your IFSUploadContextResolver in another host. Removing references preserves file bytes.

### Web Forms

```aspx
<fs:FSUpload runat="server" TextoComponente="Documento"
    UploadPage="~/FSUpload.aspx" ExtensoesPermitidas=".pdf"
    TamanhoMaximoKB="4096" HabilitarMultiplo="true" />

' No servidor, SOMENTE apos autorizar a conta:
Session("FSISA.CanUpload") = True
```

### Core

```razor
<FSUpload TextoComponente="Documento"
    ChaveContexto="persisted-grid" ExtensoesPermitidas=".pdf"
    TamanhoMaximoKB="4096" HabilitarMultiplo />
```

## Local QRCode

MostrarBotaoBaixarSvg and MostrarBotaoBaixarPng control local downloads. PNG keeps integer modules, rounding the requested size. Both examples generate local SVG without sending content to third parties. Deploy QRCoder.dll from the matching build: Web Forms uses the .NET Framework version; Core receives it through NuGet or the manual package. In Web Forms, an empty UrlServico selects local generation; a relative URL keeps an internal endpoint, while an external service requires HTTPS and explicit permission. In Core, PermitirEnvioServicoExterno=false selects local generation. MostrarBotaoCopiar explicitly copies the generated content, with a manual alternative if clipboard access is blocked. NomeArquivoBaixar configures the base name of local downloads.

### Web Forms

```aspx
<fs:FSQRCode runat="server" TextoComponente="Pedido"
    ValorComponente="Pedido 123" Tamanho="180" />
```

### Core

```razor
<FSQRCode TextoComponente="Pedido"
    ValorComponente="Pedido 123" Tamanho="180" />
```

## Scoped theme

Paleta accepts personalizada, clara or escura. Densidade accepts padrao, compacta or confortavel. Use the same scope and palette to compare pages. The theme applies focus colors, button states, borders and corner radius within the supplied selector. Custom layout classes remain available. contraste-claro and contraste-escuro are also available. The /temas page imports and exports JSON, including files limited to 4 KB. Custom colors use JSON v2; v1 remains supported. Files are previewed before confirmation, and /comparar-temas shows two independent scopes. Format v3 includes a border radius from 0px to 64px. Pasted JSON also requires preview and confirmation; the table shows differences.

### Web Forms

```aspx
<div id="cadastro">
  <fs:FSTheme runat="server" EscopoCss="#cadastro"
      Paleta="escura" Densidade="compacta" RaioBorda="8px" />
  <button class="btn btn-primary" type="button">Salvar</button>
</div>
```

### Core

```razor
<div id="cadastro">
  <FSTheme EscopoCss="#cadastro"
      Paleta="escura" Densidade="compacta" RaioBorda="8px" />
  <button class="btn btn-primary" type="button">Salvar</button>
</div>
```

## Ready-made Wizard models

FSWizardModels.Criar provides cadastro, documento and solicitacao (two steps), or integracao and compra (three steps). Supply one content slot per step. Recreate Web Forms controls in OnInit; provide RenderFragment in Core and optionally the host IFSLocalizer. Models neither grant permissions nor persist data. The five-argument overload accepts per-step subtitles and icons while preserving the original signature. See wizard-validacao-assincrona.md for Core step validation and Web Forms server confirmation.

### Web Forms

```aspx
' No OnInit, com controles novos e IDs estaveis:
Dim dados As New FSTxtBox With {.ID="Nome",.TextoComponente="Nome",.Obrigatoria=True}
Dim revisao As New LiteralControl("<p>Revise os dados.</p>")
For Each etapa In FSWizardModels.Criar("cadastro", New Control() {dados,revisao})
    MeuWizard.Controls.Add(etapa)
Next
```

### Core

```razor
@using FSISA.Core.Models
<FSWizard Etapas="etapas" />
@code {
    private readonly IReadOnlyList<FSWizardStepDefinition> etapas =
        FSWizardModels.Criar("cadastro", [
            b => b.AddContent(0,"Dados do cadastro."),
            b => b.AddContent(0,"Revise os dados.")
        ]);
}
```

## Grid presentation presets

Configure the data source, columns and authorization in the host. PresetApresentacao accepts personalizado (keeps the layout), consulta or edicao. Presets do not enable CRUD, change queries or grant write permissions. FSTheme density takes priority for configured dimensions. Reset preset preserves search, filters, page and columns and restores the presentation configured by the host.

### Web Forms

```aspx
<fs:FSGrid runat="server" ID="MinhaGrid" ID_Componente="10"
    PresetApresentacao="consulta" />
```

### Core

```razor
<FSGrid TItem="Pedido" Itens="pedidos" Colunas="colunas"
    PresetApresentacao="edicao" />
```
