Click here to Skip to main content
15,936,709 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am working with .NET Core 6. There, on button click event, after inserting data, I want to show message that data is inserted successfully. But Response.Write is not supported in my class EmployeeService.cs. How do I use Response.Write?
Here is my code.

What I have tried:

Response.Write("<form name='s1_2' id='s1_2'
     action='" + response + "' method='post'> ");
               ("<script type='text/javascript' language='javascript'
               Response.Write("<script language='javascript' >");
               Response.Write("</form> ");

Updated 5-Oct-23 6:03am
CHill60 5-Oct-23 9:53am    
Give us the exact error message you receive and when you get it

1 solution

Clearly your class doesn't have a Response property. But without seeing what your class is doing, and how it's being used, we can't really tell you how to "fix" it.

Personally, I'd be inclined to change the class so that it knows nothing about the request/response. Have it return something that can be used to indicate that the data has been saved. Then have the calling class deal with returning the response to the user. Preferably using a custom ActionResult rather than writing directly to the response, since that would make it easier to test.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900