My current project is using C# ASP.NET MVC3. Our client asked to replace a string in whole website. He wants to update string 'Hazard' to 'Risk'. I don't want to manually replace this word in whole source code. Is there any way just to display the updated word,without changing HTML code ?
Asked
Active
Viewed 60 times
-1
-
Please can you clarify what you mean by 'display the word, without changing the HTML code?' – Luke Jan 29 '16 at 09:28
-
Currently in our website there are many occurrence of word 'Hazard'. For example we have a button labelled 'Submit Hazrad report', its HTML code will be . I want to update word 'Hazard' to 'Risk'. I don't want to change in HTML code. – Prateek Gupta Jan 29 '16 at 09:32
3 Answers
1
You should have made that string a constant in a shared project in the first place ;)
You can use JavaScript to replace the text, but this will not work for anyone who has disabled javascript and cost you extra CPU cycles on the client.
The best way is imho
- Create a constant
- Use CTRL + Shift + F to search all Files for "Hazard"
- Go Through them and replace them with the constant.
If you have no variable names with "Hazard", you may even use CTRL + Shift + H to replace it all together.

wertzui
- 5,148
- 3
- 31
- 51
0
Create a resource message class put your string there and use this string whereever yo need ,in this way, you don't need to change the string everywhere class extension is .resx nad make sure access modifier should be public Hope it will help for you

Pankaj Gupta
- 378
- 2
- 10