Wednesday, March 21, 2012

Is ASP AJAX overkill for this, or just what I need?

Having to build a simple discussion forum for a site and don't want additional "create_post" pages in my site map. I thought about using a modal div to put up the "create_post" page and on post, close the modal div. WOuld it be overkill to use ASP AJAX for this, or is this a perfect fit?

Scenario: you are on the forum topic page and there is a Creat Post or New Post button. On click, launch modal div with the subject and message boxes along with a button. ON this button click, post message to database and close modal.

I was leaning towards modal over the traditional new window popup to avoid the "lost window" and "popup blocker" situations.

Thanks!

I think it's absolutly perfect for what you're looking to do. Check out MS-Ajax's Modal popup extender.

Great! Problem is I am new to this ajax kit and read the getting started and all the demos start with ASP.net Atlas Project which is already nicely configured. For a site project that already exists, this is the only instructions I found:

"You can add ASP.NET AJAX components to an existing site by modifying the Web.config file in your Web application with the configuration values from the sample Web.config file in the installation path."

Did that...now do I need to do the typical Add Reference to get at the controls?


Because the assembly is installed in the GAC, you shouldn't have to add a reference. As long as the new values are in the web.config, it should be fine. I tested it by taking an old (pre-atlas) site and adding the new web.config values into it. ScriptManager, UpdatePanel and Timer all worked without any other change.


Guess what I meant to say was the Controls like ModalPopup are not in the gui and when added to html side, not recognized.

If you haven't already, you'll need to download the Ajax Control Toolkit (in addition to Ajax Beta 2). I was able to add ModalPopup to my site by creating a Bin folder and adding AjaxControlToolkit.dll to it. Then I added this to my page:

<%

@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %>

After that, my page recognized code such as:

<

ajaxToolkit:ModalPopupExtenderID="ModalPopupExtender"runat="server"TargetControlID="LinkButton1"PopupControlID="Panel1"BackgroundCssClass="modalBackground"DropShadow="true"OkControlID="OkButton"OnOkScript="onOk()"CancelControlID="CancelButton"/>"AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>"AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
Bingo! that is what I was missing!! Thanks!

Did a cut and paste of the modal popup example and it fires. ( :) ) but doenst act "modal" I can still interact with the background. Is the source available for the online modal example?

No comments:

Post a Comment