I don't think you found a bug. ASP.Net will not directly serve a file that starts with an underscore; it has to be called from another view using Html.Partial, etc. Did you by chance rename the file to not have an underscore in the name?
Mark all posts that give the desired result the answer. If you only mark the last that gave you clarification because you misread an earlier post others will be confused. Some of us are here to help others and our point to post ratio matters.
So I suggest you could add some breakpoints in your _RepliesList action,check if replies has value,
and open F12 developer tool to check if there are other Javascript code that affect the results of the partial view.
Best Regards.
Yuki Tao
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
4 Posts
MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 01:15 PM|Dmonro|LINK
I am trying to display all the replies for a ticket on my details page.
I'm calling my action with this line
The ActionResult code is
And my Partial view code is
But when the page loads, where the replies should be its blank.
The SQL table has data in it.
No errors in compiling or loading the page.
Any thoughts?
Member
11 Points
19 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 01:40 PM|Koss86|LINK
show the definition Example.Reply class.
why
@Html.DisplayNameFor(model => model.Message)
not in foreach ?
if you put a breakpoint to
@Html.DisplayFor(modelItem => item.Message)
"item" contains data?
None
0 Points
4 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 01:46 PM|Dmonro|LINK
Here is the Example.Reply.
This is the table header, just grabs the columns name.
Hence why it doesn't need to be in foreach.
Item should be the current index of the list for message.
If I run this code on a separate page without using a partial view it works.
Member
11 Points
19 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 01:58 PM|Koss86|LINK
"item" contains data in debugger ?
Or Model in
@foreach (var item in Model)
None
0 Points
4 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 02:02 PM|Dmonro|LINK
It just randomly started working? I didn't changed anything except add a login check to another page.
Member
11 Points
19 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 02:06 PM|Koss86|LINK
I personally did not see any errors. Studio bug?
None
0 Points
4 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 02:17 PM|Dmonro|LINK
I think so.
Contributor
7058 Points
2189 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 12, 2019 08:00 PM|ryanbesko|LINK
I don't think you found a bug. ASP.Net will not directly serve a file that starts with an underscore; it has to be called from another view using Html.Partial, etc. Did you by chance rename the file to not have an underscore in the name?
Contributor
3710 Points
1431 Posts
Re: MVC 5 C# When calling a Html.Action from my controller it doesn't display anything.
Aug 13, 2019 08:39 AM|Yuki Tao|LINK
Hi Dmonro,
I test your code and work fine in my project.
I can't find anything wrong in your code.
So I suggest you could add some breakpoints in your _RepliesList action,check if replies has value,
and open F12 developer tool to check if there are other Javascript code that affect the results of the partial view.
Best Regards.
Yuki Tao
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.