Modal MessageBox for ASP.NET without jQuery - asp.net

I have an assembly with custom ASP.NET server controls that is used in several, mostly in-house, ASP.NET 2.0 applications. The server controls use simple modal popup messageboxes, which are currently implemented using the javascript alert and confirm functions.
I want to release a new version of this assembly that uses a better solution for messageboxes, including support for Yes/No buttons.
Ideally the appearance would be something like a simplified version of the Ajax Control Toolkit ModalPopup extender (sample here).
My constraints are that this should be as easy as possible to integrate into existing ASP.NET 2.0 applications without introducing new dependencies: ideally just drop in a new version of the assembly, that contains all the javascript it needs as an embedded resource, and possibly a CSS file.
Because of this constraint, I am not considering solutions I've seen that use jquery, or the ASP.NET Ajax Control Toolkit, which appears to require adding elements to pages that use the extenders (ScriptManagers and the like).
Any recommendations?

This might help..a javascript example: How to code a JavaScript modal popup (to replace Ajax)?

Related

Tagging Input for that works with ASP.Net

I'm playing with jquery tagit plugin at http://webspirited.com/tagit/. It's perfect for what I need but I can't get it to update the asp:BulletList because it's a server control.
I know there are workarounds by using ajax/updatepanel but I need something will work the the same way as other controls during the postback.
Are there any controls for asp.net does allows tagging?
I also used jQuery tagit when building my site...and I ran into the same issues you are describing. I managed to overcome all the issues and get it to work, but it was definitely not developer-friendly. In the end, we replaced the update panels with ASP.NET Web API's for partial page rendering (this is how you should be doing it by the way), and created our own tagging plugin. The jQuery Tagit plugin definitely has a few bugs, so creating our own was ultimately the best solution. Here's the problems you'll run into with jQuery Tagit and Update Panels...
Javascript loses references on update panel refresh
Firstly, when the update panel refreshes, you lose all javascript references. You can refresh these references by redefining them at the end of the page request. You can use a page request manager for accomplishing this. Here is an example:
Add a function to your javascript that redefines all javascript references located within the update panel:
<script type="text/javascript">
function contentPageEvents(){
var myTagitDiv = $('.myTagitDiv')
}
</script>
Then at the end of your page you can add this:
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_endRequest(contentPageEvents);
</script>
ASP.NET changes the IDs of its server-side controls
In order to reference an ASP.NET control, you must either use ClientIdMode="Static", or reference the CSS class of the control rather than the ID. ASP.NET controls have almost the same level of customizibility as normal HTML controls as long as you use the CssClass attribute effectively.
Don't use Update Panels
In the end, you really shouldn't be using update panels at all. The ASP.NET update panel is designed to simulate partial page rendering, but does not actually perform it. If you plan to build a decent web site and want to use partial page rendering, you should start looking into using the new Web API Controller class that comes with MVC 4. This amazing tool can be easily implemented in a Web Forms project. It is built-in in Visual Studio 2012, and can be downloaded for use in Visual Studio 2010. Here is a link to a tutorial on how to create a web api that can post items to a database:
asp.net mvc - Posting JSON data via jQuery to ASP.NET MVC 4 controller action (Stack Overflow)

Conversion from Coldfusion to Asp.net (Drag and Drop Functionality)

I have Coldfusion web application that has a CF query from a database table. This data is displayed in an HTML table with a checkbox beside each data item and an associated picture. There is Jquery functionality on the page so that the items can be re-arranged in the table based on the users preference. After the user finishes with their re-arrangement, it is re-displayed without the checkboxes for sending as an email. Note I did not write this application myself but inherited it...
I need to transfer this functionality to a asp.net C# web application but i am at a crossroads on how to proceed. I've looked at telerik controls and others but none appear to fit the functionality i need. Any solid suggestions?
I'd suggest to handle rendering of the table yourself. If you're using asp.net webforms, this can be done with a custom server control. If you're using asp.net mvc (which I suggest as MVC matches the coldfusion development model a bit closer than webforms), then it's much simpler and you can just do so in the view.
Once you are rendering the grid yourself, then it's simple to apply the jquery functionality on the client-side.
Without more info about what you can or can't do, it's a bit difficult to offer any more guidance. But you did only ask for suggestions :-)
Asp.net doesn't mean you need to use a library control built for .net. jQuery is powerful enough today, and it's not tied to any back end technology.
So, that being said, I would still go with jQuery and back it up with RESTful request using webservices with WebForms or controllers with MVC.
Have a look at this: JQuery Drag and Drop features with ASP.NET

Using jQuery-AJAX to page ASP.NET datagrid

Does anyone have, or could point me to, an example of using jQuery to page through an ASP.NET datagrid control?
I would like to page through a large set of data displayed by an ASP.NET DataGrid control however I would like to avoid a page refresh and hence want to use AJAX to get the new sets of data. I would also like to avoid the ASP.NET AJAX toolkit and would like to do it all using jQuery-AJAX. Thank you.
The DataGrid is a server side control that relies on postbacks. jQuery and AJAX are client side technologies. Write a AMSX or WCF service to serve up your data and consume it with jQuery. You can use jQuery templates to make things easier. Or wrap the DataGrid in an UpdatePanel and you will have the poor man's AJAX(sometimes called AJAH).
There may be a jQuery plugin to help with this.
Here's a nice article to get you started:
Easily build powerful client-side AJAX paging, using jQuery
Try using jGrid, it´s free, but there are commercial dotnet implementations available.
It´s quite powerfull,you can do almost everything with it. And loading your data is easy to. But, you have to forget the Idea of aspnet datagrid, unless you will use updatepanel(which is very stable and usefull and has nothing to do wiht asp net ajax toolkit)

ASP.NET Ajax Controls that still provide some level of functionality with javascript turned off

I am looking for some ASP.NET Ajax Controls (similar to those by Telerik) that, unlike those those by Telerik, still provide some level of functionality when the end user has javascript disabled. Does anybody know of any products like this?
I'm trying to do that in my open source library of components: http://nucleo.codeplex.com, but I haven't heard of any third-party specific controls. Adding that type of functionality really adds to the amount of time it takes to develop AJAX components, especially with the level of complexity of most control frameworks.

How to embed a SilverLight control in ASP.NET control (user or custom)

We have a ASP.NET web application written in VB.NET where we build content programmatically during the Init event.
We make extensive use of user controls, building them on the fly, and I now want to start including SilverLight content.
Is there an easy way of embedding a SilverLight application in a control, and then instantiating the whole thing in code, in the same way as you'd programmatically add ordinary ASP.NET controls to a page?
The SilverLight component itself works fine when added to a page using the <object> tag but I really want to be able to reuse it elsewhere in code.
Since I'm expecting use of SilverLight to increase in our application, and the asp:Silverlight control seems now to be deprecated, I'm looking for an alternative way of wrapping the content.
Thanks for any pointers.
You can make your own version of the deprecated Silverlight control - all it has to do is emit the appropriate <object> html during its Render event. This is a really straight forward 5 minute task to roll one of these up.

Resources