Skip to content

Collection Data Binding In Blazor Server #42124

@hintsofttech

Description

@hintsofttech

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

dear sir/mam,

normal object binding is working properly even when it's null.

but binding through collection not working.

this feature should also work as normal
because data can be from any resources and in any form (in this case array) as per requirement

Regards-
Sanjeeb

Describe the solution you'd like

Customer Entry Form

@page "/customerForm"
@Inject Customer[] customers
@Inject IJSRuntime js

//have registered service in Program.cs as follows
//builder.Services.AddScoped<Customer[]>();

<input id="focusedInput" @Bind="@customers[0].LastFocusedId" hidden/>

<input id="txtId" @Bind="@customers[0].Id" @onfocus='()=>LastFocused("txtId")'/>
<input id="txtName" @Bind="@customers[0].Name" @onfocus='()=>LastFocused("txtName")'/>
<input id="txtAddress" @Bind="@customers[0].Address" @onfocus='()=>LastFocused("txtAddress")'/>

<input id="txtId1" @Bind="@customers[1].Id" @onfocus='()=>LastFocused("txtId1")'/>
<input id="txtName1" @Bind="@customers[1].Name" @onfocus='()=>LastFocused("txtName1")'/>
<input id="txtAddress1" @Bind="@customers[1].Address" @onfocus='()=>LastFocused("txtAddress1")'/>

<input id="txtId2" @Bind="@customers[2].Id" @onfocus='()=>LastFocused("txtId2")'/>
<input id="txtName2" @Bind="@customers[2].Name" @onfocus='()=>LastFocused("txtName2")'/>
<input id="txtAddress2" @Bind="@customers[2].Address" @onfocus='()=>LastFocused("txtAddress2")'/>

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions