cant get DetailRowTemplate to work #5958
Replies: 5 comments 2 replies
-
Do you have a full example that we can inspect? It's hard to know what you did by a little code snippets? |
Beta Was this translation helpful? Give feedback.
-
Hello Mladen, thanks for your help. Currently i dont have a succinct example to show. I will create a minimal one to show just significat data. I also have to hide company data. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello,
Data come from SQL and this works in my datagrid:
Now i add the code of detailrow:
Now the error happens: Thank you, |
Beta Was this translation helpful? Give feedback.
-
In your detail DataGrid, you have the If possible I advise to convert public class SqlLogErgLineRaw
{
public string Message {get;set;}
} Then public class SqlLogErg
{
public string SqlLogErgDatum { get; set; } = String.Empty;
public string SqlLogErgUser { get; set; } = String.Empty;
public List<SqlLogErgLine> SqlLogErgLines { get; set;}
} And then bind that <DataGrid TItem="SqlLogErgLine"
Data="@( context as SqlLogErg ).SqlLogErgLines "
Sortable="false"
ShowCaptions="false">
<DataGridCommandColumn />
<DataGridDateColumn Field="Message" Caption="Date" />
</DataGrid> |
Beta Was this translation helpful? Give feedback.
-
Hello Mladen, thanks for your help. It is now working. Following your proposal i used a static constructor to my class which offers some string parameters and one of them was added into the list, all within the constructor code. So i got needed datatype for subdatagrid and detailrow. Thanks, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Blazorise.DataGrid 1.7.0
Hello,
as a casual programmer iam currently struggling with the DetailRowTemplate feature of datagrids.
I try to adopt this example to my usecase. https://blazorise.com/docs/extensions/datagrid/templates/detail-row
I have a observable list which delivers data to my datagrid which works fine. In my list there is an additional field which ist not visible in datagrid. It contains a long line with raw-text which should be used as the Detail Row, after clicking a row.
Unfortunately iam failing in understanding the needed datatypes i think.
I get this error:
error CS1503: Argument "1": Konvertierung von "string" in "System.Collections.Generic.IEnumerable<Blazor.Pages.MyImport.MyColl>" nicht möglich.
Which means no conversion possible from string to collection. The line which throws the error is this (I use the names from the example)s:
Data="salaries"
So it happens directly on creation of detailrow-datagrid. salaries is filled by this line above:
var salaries = ( context as Employee ).Salaries;
So salaries is created as string, which is not usable for datagrid. In my case Employee is the collection and Salaries is the column of the collection which i want to use as detailrow. But in fact this throws the error because Salaries must be something different. But i dont know what and where to get it.
Please give me a hint.
Thanks,
Hans
Beta Was this translation helpful? Give feedback.
All reactions