locked
General question about building web based software RRS feed

  • Question

  • User-1742612218 posted

    Please excuse my ignorance .. I'm not a web developer by any stretch but am trying to wrap my mind around the architecture of web applications.

    asp and aspx had the concept of a custom control. I liked this idea - a modular way to create common components and piece them together into web pages. Now we have the razor engine, which for the most part, I think is superior. However, I'm wondering how the modular design approach of asp and aspx can come across into the "web 2.0" style of making pages.

    Specifically, I'm curious about:

    1. How can I build a reusable component, such as a date picker, and insert it into many cshtml pages?
    2. Is there a framework for allowing modular components, such as a date picker, to use external CSS? I.e., a tag such as the following would automatically be added to the pages "head" section after adding a date picker component to a page: <link rel="stylesheet" type="text/css" href="calendar.css">
    3. How can we add dynamic components to said linked CSS?
    4. Can we use the same strategy to create dynamic, external JavaScript files?

    I'm interested in hearing about the best technology to do this kind of modular design work. I would be grateful for any examples, tutorials, or white papers on the latest thinking about this design process. However, the main challenge I am trying to overcome in my mind is "how do we maintain a stateless design with pages which require at least two distinct GET requests?" The two distinct requests I am referring to would be GET html, then GET external CSS.. There could be many many more GETs...

    Many thanks in advance.

    Thursday, August 28, 2014 11:11 PM

Answers

  • User-821857111 posted

    How can I build a reusable component, such as a date picker, and insert it into many cshtml pages?

    Most developers wouldn't build a datepicker, They would use a jQuery or Bootstrap based one that already exists. The same would apply to most reusable UI components. If you wanted to build your own, you can look at building a jQuery plugin. (http://learn.jquery.com/plugins/). 

    If you wanted your component to communicate with server-side code, you can use jQuery's AJAX methods for that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 31, 2014 3:13 PM

All replies

  • User-821857111 posted

    How can I build a reusable component, such as a date picker, and insert it into many cshtml pages?

    Most developers wouldn't build a datepicker, They would use a jQuery or Bootstrap based one that already exists. The same would apply to most reusable UI components. If you wanted to build your own, you can look at building a jQuery plugin. (http://learn.jquery.com/plugins/). 

    If you wanted your component to communicate with server-side code, you can use jQuery's AJAX methods for that.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, August 31, 2014 3:13 PM
  • User-1742612218 posted

    Thanks Mike. The date picker was just an example. I could have tried dreaming up something that doesn't exist any more but I'll leave that to the BAs.

    I'll look into jQuery plugins.

    Tuesday, September 2, 2014 10:19 PM