locked
how to integrate My Web Pages Starter Kit (MWPSK) with Dynamic Data? Convert Page Template to User Controls? RRS feed

  • Question

  • User-1614457691 posted
    All --

    Has anyone investigated how to integrate My Web Pages Starter Kit (MWPSK) with Dynamic Data?

     
    If case you are not familiar with MWPSK, then just know that MWPSK uses a web-user-control-based customization model whereby anything that is a user-control can be displayed on any page, and pages can be created at run-time via a Content Management System (CMS) framework.
     
    So, the problem with integrating Dynamic Data in MWPSK is that the Page Templates would need to be user-controls.
     
    While it is not difficult, in general, to convert an ASPX to an ASCX, with Dynamic Data, things are a bit tricky because URLs are built dynamically based on object name and Page Templates in the Dynamic Data model.

    As such, the trick in integration with MWPSK is to make those page templates into Web User Controls-- but, that is an issue with respect to the dynamically generated URLs.

     
    One design idea that I have to accomplish this is to take the object-name (which would have been part of the dynamically-generated URL) and pass it as a query-string parameter, then make each Page-Template (ASPX) into a User-Control-Page-Template (ASCX), then when each User-Control-Page-Template loads it would look at the query-string, determine the object-type, load the object, etc.
     
    Does anyone think that approach would work? 

    Does anyone have any ideas on how that approach could be implemented simplified?
     
    Does anyone have any other design ideas to accomplish this?
     
    Please advise.
     
    Thank you.
     
    -- Mark Kamoski 
    Tuesday, November 18, 2008 8:51 AM

Answers

  • User1641955678 posted

    Hi Mark, 

    One key piece of data that I'm missing from your scenario is about knowing what to navigate to.  Are you assuming that you will always be on the same aspx page, and that all navigations will only involve changing the query string?  Or do you also want in some cases CustomPage1.aspx linking to CustomPage2.aspx?

    Somewhere in the system, we need a predictable algorithm that takes in a table and action and comes up with the page to use for it.  I think if we always use MyCustomPage.aspx, then it can be done.

    Other question: are you assuming that you can't use Routing at all?  Or are you able to add things to global.asax to make this work?

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 21, 2008 10:03 PM
  • User1641955678 posted

    Hi Mark,

    I just blogged on doing something like this with User Controls.  Hopefully this is not too far off from what you're looking for! :)

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 25, 2008 10:04 PM

All replies

  • User1641955678 posted

    Hi Mark,

    I think a lot of it has to do with how much of Dynamic Data you want to use.  In one ascx file, you should be able to just use Dynamic Data by dropping the same controls that you normally see in a page (e.g. DDManager, LinqDataSource, GridView).  The part where it becomes trickier is the scaffolding aspect, and how it goes through the routing engine.  Then you have to start worrying about the links that get generated and having them go to the right place.

    Before we go into the implementation details, could you describe at a high level what the end result you're trying to build looks like?  Is it more:

    1. Something very similar to the default Dynamic Data scaffold app, except that you use user controls instead of pages
    2. A much more custom solution, where you want to hand user controls for some specific tables

    Maybe if I was more familiar with MWPSK this would be more obvious to me :)

    thanks,
    David

    Wednesday, November 19, 2008 6:28 PM
  • User-1614457691 posted

    ...Before we go into the implementation details, could you describe at a high level what the end result you're trying to build looks like?  Is it more:

    1. Something very similar to the default Dynamic Data scaffold app, except that you use user controls instead of pages
    2. A much more custom solution, where you want to hand user controls for some specific tables

    Well, I think that what I want would want to have pretty much the same default Dynamic Data scaffold application.

    However, instead of Details.aspx, I would want to have Details.ascx.... and.... instead of List.aspx, I would want to have List.ascx.... etc....

    That way, one could place the ASCX on any custom ASPX page that I wanted and then when I navigate to that ASPX I put the object type in the query-string.

    So, instead of going to a typical Dynamic Data generated URL like this...

    http://localhost:2440/TestDynamicEntities/Address/List.aspx

    ...I would instead go a custom URL like this...

    http://localhost:2440/TestDynamicEntities/MyCustomPage.aspx?ObjectType=Address&AddressID=2

    ...and then in decarative markup in the page...

    MyCustomPage.aspx

    ...I would have any number of Dynamic-Data-based ASCX controls.... if it has a List.ascx control, then that control would load a list of Address objects... if it has Details.ascx then it would load the Address object with AddressID=2... etc....

    ...each ASCX knows what to do and what to look for on the query string... etc...

    ...I am just brainstorming here... haven't worked out the details....

    ....maybe it would be too hard to handle more than one ASCX on a custom page.... so maybe just allow one but I would rather not have that restriction...

    ....maybe it would be too hard to handle more than one object type on a custom page.... so maybe just allow one but I would rather not have that restriction but it would be very ugly to pack a query string value with a delimited list and or ordered pairing but...

    ...etc....

     ...does any of that sound sane???

    ...what do you think???

    Thank you.

    -- Mark Kamoski

    Wednesday, November 19, 2008 10:30 PM
  • User-330204900 posted

    What you are suggesting is possible but you would need to take some of the functionality of the DynamicDataManager on the page i.e. setting up the DataSource on the page as DynamicDataManager has no way of knowing what the table would be so you will have to right code to find out which table/entity set is to be used and then set the DataSource to it.

    Hope this helps [:D]

    Thursday, November 20, 2008 4:50 AM
  • User1641955678 posted

    I'll try to put together something like this.  I actually did something like that way back relating to a question from a DotNetNuke user.  That was on a much earlier build of Dynamic Data, so I need to dig it out and see how close it is to be usable with the current framework.

    David

    Friday, November 21, 2008 7:14 PM
  • User1641955678 posted

    Hi Mark, 

    One key piece of data that I'm missing from your scenario is about knowing what to navigate to.  Are you assuming that you will always be on the same aspx page, and that all navigations will only involve changing the query string?  Or do you also want in some cases CustomPage1.aspx linking to CustomPage2.aspx?

    Somewhere in the system, we need a predictable algorithm that takes in a table and action and comes up with the page to use for it.  I think if we always use MyCustomPage.aspx, then it can be done.

    Other question: are you assuming that you can't use Routing at all?  Or are you able to add things to global.asax to make this work?

    thanks,
    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 21, 2008 10:03 PM
  • User1641955678 posted

    Hi Mark,

    I just blogged on doing something like this with User Controls.  Hopefully this is not too far off from what you're looking for! :)

    David

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 25, 2008 10:04 PM
  • User-1614457691 posted

    ...One key piece of data that I'm missing from your scenario is about knowing what to navigate to.  Are you assuming that you will always be on the same aspx page, and that all navigations will only involve changing the query string?  Or do you also want in some cases CustomPage1.aspx linking to CustomPage2.aspx?

    Somewhere in the system, we need a predictable algorithm that takes in a table and action and comes up with the page to use for it.  I think if we always use MyCustomPage.aspx, then it can be done....

    I think keeping the page sticky (staying on the same page after full- or partial- postbacks) would be a simple way to go.

    As a matter of fact, we have already edited the Dynamic Data templates to make pages a bit sticky. After getting to Edit.aspx we have users who would often edit the thing and then want to continue editing and the default behavior is to send the user back to List after clicking Update, which is less than practical for some-- so, we just keep the user on the page and let them click Cancel or our custom "Back to Previous" link to go back to List. Etc. 

    ...Other question: are you assuming that you can't use Routing at all?  Or are you able to add things to global.asax to make this work?...

    I guess I could use Routing. Maybe. I have not thus far with my Dynamic Data endeavors; so, I am not sure of the implications. However, it sounds like it is fairly simple to manage.

    Note that the context that I have in mind is a CMS-based site. I want to add pages at will and add menu-items at will. I would at run-time assign one or more ACX to a run-time created ASPX page. I am not sure if that makes using Routing out of the question or not.

    Note, on the side, that I can think of at least one other advantage of having a set of ASCX controls is to be able to make composite view pages and entry page, to show a composite object all on one page, etc, which we have found is more natural to some users when compare to navigating keys where one can lose sight of the object-at-large. We even have one solution using iFrames to show >1 Page Template on the same page-- that solution is ugly but it works.

    Etc.

    Those are my answers. I am going to look at your blog code now. I appreciate your help with this.

    Thank you.

    -- Mark Kamoski

     

    Monday, December 1, 2008 9:29 AM
  • User-1614457691 posted

    Hi Mark,

    I just blogged on doing something like this with User Controls.  Hopefully this is not too far off from what you're looking for! :)

    David

    That is awesome code-- it worked great out-of-the-box.

    It is exactly what I was looking to do.

    I really appreciate it.

    I am sure you already know, (but in case others do not realize), the same code can load Edit-based URLs, such as...

    <asp:hyperlink id="HyperLink3" runat="server" navigateurl="~/NonRoutedTestPage01.aspx?table=Products&action=Edit&ProductID=2">Test page that doesn't use routing, to load a form for Edit.</asp:hyperlink>

    ...which makes things really nice.

    Thank you.

    -- Mark Kamoski 

     

     

    Monday, December 1, 2008 10:28 AM
  • User1641955678 posted

    Glad to hear that Mark!  If you come up with some kind of solution that's more specific to MWPSK and could potentially benefit others, it'd be great if you could follow up or blog it :)

    David

    Monday, December 1, 2008 6:51 PM