I just recently started using ASP.NET so please be patient with me.
I am trying to implement a template from w3layouts.com into my ASP.NET application. I have almost successfully done it except for a div, which includes a 'data-zs-src'. The code from the template is (I guess this is my goal for the end result):
I have also found this thread, which is very similar to my problem:
https://forums.asp.net/t/2102299.aspx?add+attribute+to+div
However, the <div> in my .cshtml-File does not even have a "runat" attribute, so I guess this solution also won't work for me.
I have also found this thread, which is very similar to my problem:
https://forums.asp.net/t/2102299.aspx?add+attribute+to+div
However, the <div> in my .cshtml-File does not even have a "runat" attribute, so I guess this solution also won't work for me.
Yes, it will not work for your issue as it is used for web forms application. => .aspx file.
Seraph_Miku
I am trying to implement a template from w3layouts.com into my ASP.NET application. I have almost successfully done it except for a div, which includes a 'data-zs-src'. The code from the template is (I guess this is my goal for the end result):
Sorry that I cannot reproduce this issue from my side. Could you please share more detailed information to help reproduce the issue?
As you mentioned, you were trying to implement a template from w3layouts.com which is a pure html codes. There might be some unexpected impact during this implementation.
Apart from that, how do you check this encoded content? In my test, I can see that the rendered html is correct but escape chars appear when I checked in edit mode.
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
I have made some progress with my problem. After I published my project and ran it with the help of the IIS-Manager, the 'data-zs-src' seems to work just fine (I copied the exact HTML from the template). Now, when running it from Visual Studio it works for
some reason. I know, it makes no sense. I guess publishing my project changed some property in VS or something. I cannot replicate my issue either after trying to fix it for over 6 hours yesterday. Publishing my project somehow fixed it ¯\_(ツ)_/¯
Sean Fang
Could you please share more detailed information to help reproduce the issue?
I was following step by step the tutorial on
https://www.youtube.com/watch?v=-k9ds5oKuqE&list=LL
After I extracted everything from the template and implemented it in my project, I faced this issue. But I guess it is irrelevant now.
Sean Fang
Apart from that, how do you check this encoded content? In my test, I can see that the rendered html is correct but escape chars appear when I checked in edit mode.
I was checking the source code in my browser. The string after 'data-zs-src' was wrong. Now after publishing my project in VS, the string is correct for some reason.
None
0 Points
2 Posts
Having trouble setting Array in .cshtml (data-zs-src)
Apr 07, 2021 05:21 AM|Seraph_Miku|LINK
Hello,
I just recently started using ASP.NET so please be patient with me.
I am trying to implement a template from w3layouts.com into my ASP.NET application. I have almost successfully done it except for a div, which includes a 'data-zs-src'. The code from the template is (I guess this is my goal for the end result):
However, when I'm trying to do the same in my .cshtml, this is the result in the browser:
I tried escaping the the double quotes with a backslash, so it would look like this in my .cshtml:
The only thing that changes in my browser are the extra backslashes:
I also tried different escaping methods like:
However, all this gives me just more weird stuff in my browser, see:
I have also found this thread, which is very similar to my problem: https://forums.asp.net/t/2102299.aspx?add+attribute+to+div
However, the <div> in my .cshtml-File does not even have a "runat" attribute, so I guess this solution also won't work for me.
Any help would be appreciated :)
Contributor
3040 Points
897 Posts
Re: Having trouble setting Array in .cshtml (data-zs-src)
Apr 08, 2021 09:51 AM|Sean Fang|LINK
Hi Seraph_Miku,
Yes, it will not work for your issue as it is used for web forms application. => .aspx file.
Sorry that I cannot reproduce this issue from my side. Could you please share more detailed information to help reproduce the issue?
As you mentioned, you were trying to implement a template from w3layouts.com which is a pure html codes. There might be some unexpected impact during this implementation.
Apart from that, how do you check this encoded content? In my test, I can see that the rendered html is correct but escape chars appear when I checked in edit mode.
Result: works
Best regards,
Sean
None
0 Points
2 Posts
Re: Having trouble setting Array in .cshtml (data-zs-src)
Apr 08, 2021 06:34 PM|Seraph_Miku|LINK
Thank you for your answer Sean,
I have made some progress with my problem. After I published my project and ran it with the help of the IIS-Manager, the 'data-zs-src' seems to work just fine (I copied the exact HTML from the template). Now, when running it from Visual Studio it works for some reason. I know, it makes no sense. I guess publishing my project changed some property in VS or something. I cannot replicate my issue either after trying to fix it for over 6 hours yesterday. Publishing my project somehow fixed it ¯\_(ツ)_/¯
I was following step by step the tutorial on https://www.youtube.com/watch?v=-k9ds5oKuqE&list=LL
After I extracted everything from the template and implemented it in my project, I faced this issue. But I guess it is irrelevant now.
I was checking the source code in my browser. The string after 'data-zs-src' was wrong. Now after publishing my project in VS, the string is correct for some reason.
Thanks for your help :)