I have been asked by my boss at work to look into allowing widgets on our home page that can be dragged and dropped and the setup saved for each logged in user (or maybe done by cookies so user doesn't need to be logged in).
Are there any out of the box (preferably free) libraries that can be used? If it requires server side functionality then that's got to be c#/.NET.
I can probably put something together myself but it seemed very much like it is reinventing the wheel. :)
And this is my first question just asking for a recommendation so I'm not sure if this is the right place or if I should put in more details.
An example of the kind of thing I want is http://www.google.com/ig.
And sorry if this isn't a well formed question. I wasn't sure where else or how else to ask it. :)
jQuery & jQuery-UI will do this out of the box if you use the sortable function. The "portlets" demo seems to fit your description. You'll still need to save state manually, but that shouldn't be too difficult with an event listener.
This is a good tutorial of how to build something similar to Google's IG by using ASP.NET AJAX. The source code is a bit outdated, but you can get an idea of what should be done on the client and on the server and re-use the code:
http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx
Also take a look here:
http://www.codeproject.com/KB/aspnet/drag_drop.aspx
Related
I've been trying to find the answer to this question in the forum. Maybe I'm not phrasing is correctly when searching, but is there a way to disable the use of navigation of a deployed site through inputing controllers and methods in the url.
In other words, only allowing navigation through buttons in the views.
If you are using this as some sort of security measure you should go stand in a corner and rethink your security-strategy ;)
If not, you could tag-on a session-id or something to every link and button and then verify that in the controller.
I think you should rephrase the question and include why you want to do this, maybe we could help you rethink the whole solution...
I have a simple yet not so easy question. (So, I suppose)
I have a current DurandalJS application in production. I am generating my views using C# Razor syntax. So, I am still using my controller to pass the HTML to the client. Rather complicated to get setup using routes/areas/etc but it has been working.
I am using server side for only one real reason. (other then validation, but we can ignore that for now as I am sure model validation has improved and there are ways to handle this now)
Lets say I have a button. And I only want to show that button on the screen if the user is an admin. Now, of course I can use KnockoutJs (or Auelia/Angular/whatever) to find out the users roles and "hide" the button. But as far as I know, the button is still inside the HTML? (it is in Durandal, not sure if the newer libraries handle this different). So, currently I use server code to do the check then the HTML gets rendered without the button.
Knowing how many people use SPA type libraries, what are most of you doing for simple use cases like this?
Oh, yes, on the server for the return API call, we would have security anyway, so assuming someone activated the button it would not work anyway, I simply do not want my users ever seeing it.
I have a general question and I have no code to show (because I wouldn't know what to try).
I have tried to research this, but I guess I'm either not searching for the right keywords (or looking up the right words in my book's index), or such thing doesn't come easily.
All I want to know is if there is a way to post, using the common form method, in WebMatrix (C#) that will not change the position of the screen after post, regardless of what that position may be?
It may not exist, but it seems like it might, and I would hate to think it didn't exist, if indeed it did, just because I couldn't find any topics on it.
Usually you'd use Javascript/Ajax to submit your post asynchronously. But since you asked for the "common post method", which I assume you mean a normal button-click post event, you should check this answer:
ASP.NET MVC3 Razor - Maintain scroll position on postback
Ok, so long story short, I was working on a .NET WEBFORMS project which was capable of creating ASPX pages through an ASPX form, which was basically a drag and drop controls page which, we could say, seemed to be a basic but functionality acceptable page/wizard/aspx-creator.
Well, now my higher-ups decided that approach is not a worthy solution and, I don't know why, they got into their heads that this, instead of this ASPX creator form, could be implemented through custom controls added to the toolbox.
So, my doubt is... is that even possible? Or better, is that a reasonable solution? I mean, the first cons I've already found is the fact It seems that it's impossible to yield CodeBehind code by the drag and drop method.
Thanks in advance!
Custom Controls
This MDSN walkthrough teaches you aboutmaking custom web controlls for asp. these would be able to appear in your tool box and could be dragged into its respective place, is this waht you are looking for?
EDIT:
Re-reading it looks like you want to be able to drag in bits of code and have certain regions prompted for edits, this CAN be done, using snippets. if you type propg or propfull and tab twice it constructs that code and tells you what bits to edit right? you can make your own snippets!
Creating custom snippets
failful msdn tutorials to the rescue once more!
I was just curious if it's possible to put a "separator" (Not sure what you'd call it) in a textbox in ASP.net. For example, I want a textbox on my form to be a blank textbox with "blank:blank:blank" so they can just type the time, and another to be "blank/blank/blank" for the date, and so on. I've tried googling it for a bit but didn't find what I was looking for, probably because I'm calling it a seperator, and I'm not sure how accurate that is. I was hoping it could be done that way, but if there's another way, I'm using C#. Let me know if I explained that right at all or if you can recommend anything. As before, I appreciate the help from this community!
Probably should start with checking out if an input mask meets your needs. The AJAX Control Toolkit might be a good place to start when looking at easy to use controls. Check out their MaskedEdit control at: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/
Use the MaskedEdit control in ASP.NET (from the AJAX Control Toolkit), should do exactly what you want.
HOW TO Use the MaskedEdit Control in ASP.NET