The new asp attribute "showat" should be inconsistent in VS2010. What for?

When I generate code using T4 templates in Visual Studio 2010, I get the following error for each of my asp controls when trying to compile:

The ddState control does not have the required showat attribute.

I have never received this error in previous versions of .NET. In addition, I do not get this error when I manually create my pages either by dragging and dropping, or I don’t get it when I print the control text myself. When I generate the code, I need to manually add showat="client" to my tag so that the compiler is happy. As I understand it, I never had to explicitly specify this tag. Following:

 <asp:dropdownlist id="ddState" runat="server" showat="client" /> 

solves the problem. Why should I add this to the generated code, but not at another time?

(This is a VS-2010 web project project using VB, if that matters.)

+4
source share
5 answers

Make sure VB does something on the web form design page when you use the IDE to add a control. I'm not sure how VB inserts an implicit tag. But this will be what the T4 template will miss, just a thought ...

+1
source

Obviously, .NET 5 or another of these superservice packages will allow the so-called targeted rendering. It was originally intended to be used only in the context of web forms, but I recently heard that in MVC (using some helper classes) and in services using WCF there will be some kind of fancy way to use it. It will work well with dynamic data, but is very loosely related to it; You can use one or the other yourself. If you configure your dynamic data to specific tags, you can create it on the client, etc.

Now just put showat="client" in all your tags, and all is well. This should be an implicit default, but I heard about cases where the IDE seems to require it. In the future, showat="client" will be the safest parameter, giving expected behavior in 99.9% of cases.

+3
source

This is required in VB, but not C #, so sometimes it is not required. To be more specific, the C # compiler puts the equivalent of showat=client in IL automatically unless you specify a showat target other than client .

+2
source

"showat = 'client'" currently has little effect on your encoding. This is the main goal for future weekend WCF targeting, which they want to be backward compatible. So far, the only possible value is “client”, but in the future there will be other possible values ​​that will allow preliminary rendering of cached values ​​and, apparently, “pushing” the output to services. An example that I saw in the last camp of code is where you can click on a service (possibly) on the same site, as well as on a client machine, for logging / debugging. You have something like (for using your example):

 <asp:dropdownlist id="ddlCP" runat="server" showat="client, logService" /> 

. and then the rendering will go to your log file. Or, to your session provider (if you have multiple web servers and you use a shared session provider), etc. I think the logService above should be defined in the web.config file or something like that.

+2
source

Agreed that my VS2010 solves this problem for you. Then you can completely remove the tags. I would suggest getting an update. It works well for $ 599. Otherwise, try adding showat = "client" to all tags. I think Rising Star got this right, although I have not tested it yet.

+1
source

Source: https://habr.com/ru/post/1305781/


All Articles