Dummies guide to making dropzone.js work? - c#

I'm trying to implement a drag-n-drop fileupload to my website and found a piece of java called Dropzone.js, it holds everything i need . . . i just have no idea of how to use it!
So far I've been programming only in razor ASP.NET (c#) / HTML / CSS, but so far no javascript / jquery.
It's razor webpages, so no mvc.
Due to my current lack of knowledge in java, i apologize in advance but i'm stuck !!
What i'd like to know is:
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
Any help in this will be greatly appreciated.
Kind regards,
Daniel A. Rischel
.. Edited as per requested.

Well, you're wrong somewhat. It might not be related to the question but please note these scripts are JavaScript and
java != javascript
Got the point? :) Please try to note this in future. Also, Java code cannot be added to these server-side language, because java itself is a language. You can use JavaScript or its library (jQuery) and create some plugins.
I'f i've understood things correct, i should not modify Dropzone.js directly, i should use it as a library and integrate it in my other scripts, e.g. in another .js file. Correct?
True, you need to link this plugin dropzone.js to the site using
<script href="/link/to/dropzone.js"></script>
Then you'll use this script on the whole of the page where it is linked.
And you should never edit the source code of a plugin, untill or unless you know what you're doing. Because you might mess up with the code.
I'd really like to see some source code examples of what a single file drag-n-drop fileupload form would look like. I've googled extensively but not found something i can use yet.
Did you try to read their documentations? They have a good code explaination on the default (main) page of their website too. And really it depends on just the way you style it. Its just a plugin, you will need to add your own CSS code to style the form. This plugin won't style the form for you, all it will do is to handle the upload events and get back with the result. So, which means that form creation and elements is all upto you!
If there is a dummies tutorial in making this work, i'd really like to be pointed in the right direction!
There is no perfect answer to provide you with, however I will provide you with some basics
http://www.javascriptoo.com/dropzone-js
https://stackoverflow.com/questions/tagged/dropzone.js?sort=newest&pageSize=15 (stackoverflow tag)
In the second link, you can go and see what are the very basic of the issues that are handled with what code. Easy methods will be hanlded by you! You'll need some guidance in just the hard jobs. Good luck for that!
My suggestion for you is to first undertand and learn jQuery, then learn how to make ajax calls. After that you'll know how to create and handle the events. The basic code will be
$('input[type=file]').change(function () { // change in value
// send the file via ajax
}
http://jquery.com
This method will be best as you will know what code you're using and what it will do. Using plugin is easy method then this one. But my preference is with the second one; creating your own plugin.

Related

Can I handle HTML5 events with C# handlers?

I have a button
<input type="submit" value="Click Me" onclick="substitute()"/>
In one of my first HTML5 pages. Is there anyway I can write the body of the substitute method in C# code?
Or is it that I have no other option other than JavaScript?
The only way to have C# respond to a web page is to POST the page to a web server, or execute an AJAX request. On the web server side, your request will execute some method that contains C# code.
But it really depends on what you are trying to do; some things are better handled in the browser. Study up on ASP.NET MVC and Javascript, and your strategy will become clearer.
There are some tools that you can use to write code in C# that will be run in the browser. However this requires automatic translation of C# into JavaScript (as only JS is supported by all browsers). This maybe useful if you want to share code in C# between your Desktop app and Web app. The drawback is that any error on the page will be in the auto-generated JavaScript and you will have to somehow map this to your C# code, which may be hard.
Take a look on:
JSIL
Saltarelle
You can find more information in the Miguel de Icaza blog post:
http://tirania.org/blog/archive/2012/Sep-06.html
Like an alternative, I can offer you to look on
TypeScript which is JavaScript language's superscript, with the syntax comfortable for C# developers made by Microsoft.
Very interesting and promising project, but still in active development, as far as I know, so keep an I on regressions and retrocompatibility, if you decide to you use it.
Hope this helps.

ASP.NET making a user controlled template with WebControls in them

I would like to make a system where my users can customize the look and feel of my webapp.
My goal is to give them an HTML editor and some predefined tags like [BUYBUTTON] and [PRODUCTLIST] they can use.
These tags should be replaced with actual ASCX controls so that they not only display the HTML output, but have any code-behind functionality.
A generic find and replace of text/html is easy, I can't wrap my head around how to make the controls embed into the template.
Can someone give me a little push in the right direction here? I will be doing this within a DNN module if it matters.
I would look at how DNN's XML Skin parser works.
I wasn't able to find any good tutorials but here is a link so you at least know what Im talking about.
Cheers.
I would suggest to look at the source code of announcement module, which is doing almost same thing that you want to do.
Only difference here is, announcement module is storing the template in settings, so you can have different layout templates for different modules on same page/portal.
Hope this will help you, happy coding

How do you use script# to create a jQuery plugin?

The only example of a simple script# jQuery plugin I could find online is here:
http://groups.google.com/group/scriptsharp_coding/browse_thread/thread/40769da17b0bb8d2?pli=1
The JQuery object from ScriptSharp 0.7.3 does not appear to expose a fn property or method though, so I am not sure how to continue.
Has anyone done this before, and could possibly give me a few tips?
Ok sorry for the initial trivial search. This page nicely explains how to do a jq plugin with script#:
http://michaelmurray75.wordpress.com/2011/07/16/getting-started-with-jquery-plugins-with-mvc-and-script/
You can get the whole code here

Creating a Chatbox with AJAX, HTML and C#?

I am using the Nancy Web Framework in my C# Console Application to basically create a Web Administration panel for my software. I have opted to use the Spark View Engine, as it is basically just HTML. I basically want to create a chatbox, except pull the data written to my application's console every X seconds and display it in a box instead.
I have very little experience with JQuery and AJAX, but they aren't overly complicated from the examples I have seen. The issue I am running into is that ALL of the chatbox and shoutbox examples use PHP.
I basically just need something like this...
The only difference is I need to pull the information from my application instead. I can use basic C# methods inside of the HTML (and probably inside of javascript but I haven't tried this). What would be the best way to do this, and are there any examples floating around that don't use PHP?
This was completed using AJAX and JSON.
Well, to use HTML for styling inside some PC program is just not wise. It has much better UI engines, though. But for your information here is nice jQuery shoutbox tutorial, but well, you only need to handle data input and output with C#, so actually I see no problems. The engine which you are using should have some kind of data stream, or requests handler (bla://program/???)

Sharepoint basics and any useful resources?

Sorry about having 3 questions in one but they are closely related and should be simple for someone familiar.
I'm used to coding Java/Obj C/PHP and am finding trying to modify a template somewhat annoying partly because it doesn't make sense but mostly I can't find resources.
I am editing a master template and have gotten the basics but some things still allude me.
With the ContentPlaceHolders, is there a way to use it more than once? Someone posted some code about how you can do this but it said I couldn't use code here.
Is there a way to modify these ContentPlaceHolders without using Sharepoint designer?
I thought using the SharePoint: tag would be a possible way around this, but I can't find any docos on the possible tags and what they do and where to use them.
Thanks for any help.
A ContentPlaceHolder in a master page only maps to one Content section in a page/page layout.
Yes, you can modify the contents of ContentPlaceHolder using code, building a control tree.
The SharePoint tag prefix is used to signify a different control namespace, but there is no sharepoint:placeholder
Maybe if you explain what you are trying to do, we might be able to advise you the best way.

Categories

Resources