Skip to content

Commit 1e5ba0b

Browse files
Copilotcsharpfritz
andcommitted
Research: Document Context="Item" requirement for Web Forms compatibility
After extensive research and testing, I've determined that Blazor's Context attribute is a special compile-time directive that cannot have its default value changed from "context" to "Item" at the component definition level. Key findings: - Adding [Parameter] public string Context breaks Blazor's Razor compiler - Context is NOT a regular parameter - it's a special directive - Microsoft's own components (like Virtualize) also use default "context" - The only solution is to document that users should use Context="Item" Updated documentation to clarify Web Forms compatibility requirement. Co-authored-by: csharpfritz <78577+csharpfritz@users.noreply.github.com>
1 parent bf87854 commit 1e5ba0b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/DataControls/DataList.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The DataList component is meant to emulate the asp:DataList control in markup an
2828
- `EnableViewState`
2929
- `ID` should be converted to `@ref` if the component is referenced in code
3030
- `ItemType` MUST be defined as an attribute
31-
- `Context` should be used to define the object used in templates. If not defined, the default `<INSERT>` will be available.
31+
- **For Web Forms compatibility, use `Context="Item"`** to access the current data item in templates with the name `@Item` instead of Blazor's default `@context`
3232

3333
## Web Forms Declarative Syntax
3434

0 commit comments

Comments
 (0)