.NET Framework Endpoint Examples? #2354
Replies: 2 comments
-
I played around with the endpoints some more and figured out how to return a partial review. I used a regular Controller instead of an ApiController. I am happy with returning a partial view as pure html code. Now I have run into a different problem. I have having trouble calling the endpoint with Htmx. I can execute the endpoint in a browser with this example: "localhost:44300/Home/GetCityList/95112" I tried to call that with the following code. What am I doing wrong here?
|
Beta Was this translation helpful? Give feedback.
-
I feel like an idiot. I had everything set up but I failed to add the htmx.js script file to my page. Once I did that things started working. |
Beta Was this translation helpful? Give feedback.
-
Does anyone know of any .NET Framework endpoint examples that work with HTMX?
Background
I have been searching for .NET Framework endpoint examples on Github and the wider Internet. All of my results return .NET Core examples. I don't want to get into a debate about upgrading to .NET Core. I can't due to decisions made well above me. I have created endpoints returning System.Web.Mvc.ContentResult by generating the html as a string and returning. This is really clunky and feels like I am doing it the wrong way. The IDE does not pick up on the html which makes it easy to make syntax errors since it turns the IDE into just a text editor.
What I want to do is to render a partial view and either return the partial view or convert it to a string and return that. I would like to see working example of what others have done to find a better way than writing html in a string.
Beta Was this translation helpful? Give feedback.
All reactions