Reputation: 1476
I am getting an error of null
value in the following code in MVC asp.net
;
@Regex.Replace(Model.FullDescription, "<[^>]*>" ,"")
I am trying to replace any HTML
tag with empty string. In popup window it shows result correctly without HTML tags, but on page it is showing above null value error.
Upvotes: 8
Views: 21060
Reputation: 24569
You are passing it a null
as its first parameter and it tells you in error message:
Value cannot be null.
Parameter name: input
Try to check it on error with null validation
@Regex.Replace(Model.FullDescription ?? "", "<[^>]*>" ,"")
Upvotes: 8