Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fetch list of model keys from razor file? #589

Open
hardik-dhankecha123 opened this issue Jul 20, 2022 · 0 comments
Open

How to fetch list of model keys from razor file? #589

hardik-dhankecha123 opened this issue Jul 20, 2022 · 0 comments

Comments

@hardik-dhankecha123
Copy link

I want to fetch list of model keys which are mentioned in the razor file. So how can I fetch the list of keys? My project is based on the forms and fields so based on the keys it will find the fields from the appropriate forms. That's why I need to fetch the keys list from the razor file.

For example: below is a sample razor file.

<acord>
  <student>
     <firstName>@Model.StudentFirstName</firstName>
     <lastName>@Model.StudentLastName</lastName>
     @if(@Model.StudentPhone != null)
     {
        <phone>@Model.StudentPhone</phone>
     }
  </student>
  <parents>
     <firstName>@Model.parentFirstName</firstName>
     <lastName>@Model.parentLastName</lastName>
  </parents>
</acord>

From above sample file I need a list of keys like @model.StudentFirstName, @model.StudentLastName, @model.StudentPhone, @Model.parentFirstName, @Model.parentLastName.

So how can I achieve it? and how can I get a list from the razor file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant