How to render the multiple card items inside the single list items in Blazor ListView

Query: How to render the multiple card items inside the single list items in Blazor ListView


Answer:
We can render the two-card items inside the single list items using template support.  We have prepared a sample based on your requirement.  Refer to the below code snippet. 

 <SfListView ID="List" 

                    DataSource="@ListData" 

                    Width="100%" 

                    Height="800px" 

                    EnableVirtualization="true" 

                    TValue="Product" 

                    CssClass="e-list-template"> 

            <ListViewFieldSettings Id="Cod" Text="Des"></ListViewFieldSettings> 

            <ListViewTemplates TValue="Product"> 

                <Template> 

                    <div style="width:100%"> 

                        <div style="display: grid; display:inline-block; width:50%;justify-content: center; justify-items: center; align-items: center; column-gap: 15px; box-shadow: 0px 0px 2px gray;  margin:4px;padding: 10px;"> 

                            <div style="grid-column: 1; grid-row-start: 1; grid-row-end: 3"> 

                                <img src="P@((context as Product).image).jpg" /> 

                            </div> 

                            <div style="grid-column: 2; grid-row:1;"> 

                                <p>@((context as Product).Cod)</p> 

                            </div> 

                            <div style="grid-column: 2; grid-row:2;"> 

                                <p>@((context as Product).Des)</p> 

                            </div> 

                        </div> 

                        <div style="display: grid; display:inline-block;width:48.5%;justify-content: center; justify-items: center; align-items: center; column-gap: 15px; box-shadow: 0px 0px 2px grey;margin:4px; padding: 10px;"> 

                            <div style="grid-column: 1; grid-row-start: 1; grid-row-end: 3"> 

                                <img src="P@((context as Product).image1).jpg" /> 

                            </div> 

                            <div style="grid-column: 2; grid-row:1;"> 

                                <p>@((context as Product).value)</p> 

                            </div> 

                            <div style="grid-column: 2; grid-row:2;"> 

                                <p>@((context as Product).Number)</p> 

                            </div> 

                        </div> 

                    </div> 

                </Template> 

            </ListViewTemplates> 

        </SfListView> 



Find the sample to render the multiple card items inside the single list items in Blazor ListView from here.

2 Replies 1 reply marked as answer

RR Richard Rooks July 2, 2021 12:53 PM UTC

link for sample is not working



IL Indhumathy Loganathan Syncfusion Team July 5, 2021 05:27 AM UTC

Hi Richard, 
 
Sorry for the inconvenience. 
 
Yes, the shared sample link is not working due to incorrect Url. Please find the runnable sample link below. 
 
 
Kindly check the sample and get back to us if you need any further assistance. 
 
Regards, 
Indhumathy L 


Marked as answer
Loader.
Up arrow icon