Are there any ASP.NET template technologies that can be used both on the client side and on the server side?

I am currently working with ASP.NET 2.0, which may explain why I am not as much as possible. However, I do not see a complete solution in my Googling ASP.NET MVC, etc.

Here are my background thoughts.

First, data-bound patterns are really useful. I am currently dealing with a lot of legacy code through which people create software tools, both on the client and on the server, and this is a huge pain.

Secondly, sometimes you want data controls to bind to the client, sometimes on the server. The most obvious case for data binding on the server is where you are trying to take into account that people have disabled javascript. But the problems of speed, caching, bandwidth, etc. Everyone plays a role in deciding where to tie.

Now on the server I can write UserControls with data binding points. And on the client, I can write templates and associate them with jQuery (I am currently using the John Resig microterminal mechanism as amended by Rick Stral ). But ideally, there should be a way to write a template once, and let the plumbing make it available both for data binding on the server, and on the client side. I assume that XML / XSLT will be one approach to this, but terrible. So what else? This should not be an ASP.NET 2.0 solution; I just wanted to think that there is a fix somewhere.

+4
source share
2 answers
0
source

You can create β€œdata source” objects that are independent of our controls / data templates.

To use them with your data binding control, instead of attaching them declaratively, for example:

<asp:gridview ...datasource="myDataSource"...> 

you can attach them with a code: (some event)

 me.Gridview1.datasource = "myXMLDataSource" 

--- or ---

 me.Gridview1.datasource = "mySQLDataSource" 

If you install data sources ahead of time (either in .aspx or in the code, this is normal), then you can switch data sources based on any event or logic whenever you want, without the need for re-coding / re-publishing.

-1
source

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


All Articles