CodeCharge Application - asp.net

I need to make small asp.net application in codecharge.
Please tell me how to add server side event into that app and how can i get textbox value in server side.

Have you had a look through the examples here:
http://examples.codecharge.com/

This is going to sound like 'RTFM' but... the Help file that comes with Codecharge is quite extensive and goes through many of the common tasks (in the case of CodeCharge Studio (CCS), it does it for each language - PHP, .NET, perl, JSP, coldfusion, ASP). See the links below for the online version.
An example of using the Server Side events (Before Insert) to modify a control's value is shown in all languages (see 'Replace Control Value Before Inserting' and choose your project's language at top-right of page).
As with most frameworks, a lot of the gathering of POST values from controls are already done and ready to use at run-time. CCS has lists of the properties and methods of its 'components' in the Help as well. Most languages have something like 'GetValue()' in their run-time properties - check the Text Box Component Reference section of the Help. For .NET it's 'GetFormattedValue()'
CCS also has a lot of pre-built 'Actions' to use in the Events - so in a lot of cases you don't need to code it yourself, there may be an Action to Help. You can also choose an Action, get CCS to make it, double-click on the Action, and view the generated code for tips. You could then delete the Action (don't delete the code, delete the Action and let CCS remove the actual code) and you can then add 'Custom Code' and put in your own. I have used that method when learning a new language in CCS.

You use within an event on the server.
Login1.GetControl<InMotion.Web.Controls.MTTextBox>("login").Text

Related

Creating an image handler in Visual Basic for Ajax file upload

I'm not asking for detailed code for this question, but rather solid direction to learn how to do it myself. There appears to be many methods and directions so just looking for a headstart from someone experienced.
I have a simple file upload control. I want it to operate as an ajax upload, no page-refresh, and if I'm understanding correctly I need http handler that grabs the image and deals with it behind the scenes.
So I need to create a custom control, a new file upload that allows me to set some properties, such as... Path for the image, prefix for three different types (I.e. thm_uniqueimagename.jpg, med_uniqueimagename.jpg, lg_uniqueimagename.jpg) and an option to either KeepOriginal="True/False".
I'd like to see a progress bar while the image is uploading as well. A fantastic example would be a post on Facebook and how you can upload an image.
Right now I'm stuck with a standard upload control that has full post-back/refresh and it's just not nearly as attractive.
I'm just now learning VB... So basically if you can say... Read this tutorial, then do this, then do this... that would be greatly helpful. Just overwhelmed with what to do first, and how to put it all together.
Platform: Windows, .net, etc.
Thank you for any advice.
If you want a better user experience, then I suggest you investigate some solutions like the following:
ASP.NET AJAX file upload
AjaxFileUpload.
Note: If you read the documentation for the ASP.NET AJAX AjaxFileUploader, it says that it requires HTML5 for the progress feedback; otherwise it shows a spinner. So if progress feedback is a necessity and you cannot fully support HTML5 in your target browsers (i.e. older versions of IE; IE6, IE7, IE8, etc.), then you should look into the options below.
Custom HTTP module
NeatUpload is a free option.
Silverlight/Flash option
SWFUpload is a free option.
Asynchronous chunking option
RadAsyncUpload - Telerik's ASP.NET AsyncUpload is a pay option, check website for pricing.

The best approach for multilingual user interface

I am working on a multilingual web application. I'm wondering how do i design the best user interface that the user can localize data for various languages? for instance, in making a page which its title is different in every lang, do i put a textbox for every one? it's not a suitable way to do(in case of 10 lang, the user has 10 textbox!!! too silly)
what is your idea about this?
Edit: i have no problem with globalization in my system. in fact, i'm looking for a good way for my interface design which user can enter his data to my forms in various langs.
thanks in advance
What about only one textfield and a dropdown containing the languages. After selecting the language and filling out the textfield the field gets submitted and the chosen language disappears from the dropdown list.
the entered value and language then appears beneath the dropdown and textbox with a way to edit/delete it. this way it's always clear to the user which languages are already covered and which values are assigned to them. furthermore it's a nicer way if not all 10 languages have to be mandatorily filled in, if the user e.g. just knows english and french.
Hope you know what I mean, otherwise I'll have to create an example screenshot :-)
You could have 3 text boxes, and that's fine...get to 10, and it starts getting a bit crazy. Beyond that it starts looking pretty bad.
Maybe you could put up to say 5 text boxes up...but if it goes beyond 5 (because the user desires localization for more than 5 places) it places a single textbox with a dropdown next to it, and the dropdown would contain the current language.
Textbox would auto-populate with the current value for the language selected in the dropdown. Should work well in asp.net, and it can be done both client side, or server side on a post back pretty easily, so you don't need to do anything crazy for people not running javascript.
You have one text box.
On load you populate the text box depending on language.
The content will be populated from some kind of resource file. If there isn't much text it could even go in your config file.
Be aware of the following:
Different content length depending on language.
Right to Left alphabets screwing up your alignment
This is a classic project for using NUNIT or similar to promve that things work after new translations are added!
What language do you use in development? If this is something like PHP, then you definitely should use templates and load text strings into them from configuration files for every language. In Smarty, for example, I use configuration files for that.
Text strings for error messages or something like that could be put to files like .ini and loaded from there.
The Google Web Toolkit (GWT) demo shows the same page with versions available in English, French, Arabic and Chinese.
The GWT docs have a thorough discussion of internationalization. You could emulate their implementation.
Constants: Useful for localizing typed constant values
Messages: Useful for localizing messages requiring arguments
ConstantsWithLookup: Like Constants but with extra lookup flexibility for highly data-driven applications
Dictionary: Useful when adding a GWT module to existing localized web pages
Remember that dates and times are represented differently in different locales, if your forms use them.
The W3C also discusses Internationalization Best Practices in HTML content.
Normally, a user navigating a website will have a preference specifying the language of the whole site. I think it would be confusing to break this pattern.
So, in an intro page, or a user preferences page, allow the user to select a language; then, on the other pages, display a consistent set of controls to be able to edit the content on each page.
Are you making an administration page that allows users to change the text used in other pages in the application?
If so, you could use grid like in Zeta Resource Editor:
thumbnail http://img202.imageshack.us/img202/7813/zetaresourceeditor02.th.png
Or you could make a per-language list like in nopCommerce:
thumbnail http://img249.imageshack.us/img249/9079/nopcommerce.th.png
You can use javascipts as a resource file for your language like. language_arabic.js, language_english.js,etc.So when a use wants to see his preference language he/she has select the available languages from drop down list. Regarding this the user has to change the language settings from his/her computer. This is what I did while I was working a GIS project to customize a Geocortex IMF( http://demos.geocortex.net/imf-5.2.2/sites/demo_geocortex/jsp/launch.jsp ) site for an Arabic client.

Placing jQuery Refernce at the bottom of HTML Document breaks User Control

Walter Rumsby provided a great answer to Where to place JavaScript in an HTML file. He references the work done by the Yahoo Exceptional Performance team and their recommendation to place scripts at the bottom of the page. Which is a hard and fast rule that I've been following for quite sometime now. In the same thread Levi Rosol pointed out "the best place for it [JavaScript] is just before you need it an no sooner." That is the predicament that I now find myself in.
I've added my reference to jQuery at the end of my page but have run into an issue with how to structure a user control that I'd like to add client side functionality to. Specifically, I am having a hard time working out the best way to accommodate dependencies. The user control has a span tag containing a numeric value that I'd like to update based on the number of check boxes the user has checked in the user control. I am using jQuery to find the span tag and update its text property.
Unfortunately, unless my reference to jQuery appears prior to the user control I receive JavaScript errors. This makes sense because the control is referencing functions that have not yet been added. I can think of several solutions to the issue but am looking for a best practice option.
Placing a reference to the jQuery library inside of the user control.
Downside: if the user control was placed into a repeater multiple references to the jQuery library would be made.
Put no JavaScript in the user control and write all code to update the span tag for the user control in the containing page.
Downside: I'd end up with the same code in multiple places creating a potential maintenance nightmare.
Place the jQuery reference in the head section of the page.
Downside: I've violated the recommendation to place scripts at the bottom of the page and have created an unusable user control if the page does not include a reference to jQuery.
Those are the options and downsides I came up with when thinking about solutions to this problem. I am certainly open to suggestions for better solutions and barring none looking for a recommendation of which of the three I should choose.
There's a Google project that aims to solve these pains you may want to look at called Jingo:
http://code.google.com/p/jingo/
Another solution I'd recommend is a loader like YUI Loader Utility.
http://developer.yahoo.com/yui/yuiloader/
It will allow you to manage dependencies etc. and it's not just useful when you're using their UI components. It can be used for anything; just look at the docs around addModule.
If you're using ASP.NET the ScriptManager is another good solution.
Another option would be to dynamically generate the script reference by registering a startup script from your usercontrol that wrote a script reference to the document head.
The javascript function could check for an existing jQuery reference, and if none was found, write the reference out. This would solve the multiple references. A basic example was discussed in this thread.
The simplest solution to this I've found is to use a helper to accumulate Javascript fragments to be included at the page body while rendering other page elements. Then, you can include jQuery first, followed by any deferred literal Javascript fragments.
It does require maintaining some extra state during page generation, which can complicate your rendering pipeline just a bit. However, it allows you to get deferred Javascript inclusion, without requiring complex DOM manipulation after the page is loaded to pick out any existing references to jQuery.

HOW TO MAKE localization?

I have a question about localization
how can i do localization lets say that i have a dropdown list
that holds the available languages: English,french and arabic
and I have a label which get it says "good morning",so i want to change the lang. according to selected lang. in drop down list so when the user chooses french label will say "bonjour" and when the user slect arabic the label will hold "صباح الخير" AND MOVE IT FROM THE LEFT OF THE PAGE TO THE RIGHT BECAUSE ARABIC IS WRITTEN FROM RIGHT TO LEFT ,,
ANY HELP WILL BE HIGHLY APPERCAITED
THNX IN ADVACE
In short, localization in ASP.NET is fully supported using resource files, e.g. files containing strings, images and other resources for each user interface language. They're named after the culture, for example MyResources.en-US.resx or MyCulture.fr-FR.resx.
The only thing that is a bit tricky is handling LTR and RTL languages and, as far as I know, must be done "manually", via code, or via CSS.
You might want to check some documentation on MSDN.
Have you ever saw the Localization video tutorials from ASP.NET website?
How Do I: Create a Multi-Lingual Site with Localization?
and
How Do I: Localize an ASP.NET AJAX Application?
They are great to get you started...
you can create an http module that is going to read the html from the output stream and translate it,use RegEx and make sure not to translate html tags and JavaScript
there is also the asp.net standard (built-in) way, with resource files, just right click your project and click add items resource file, you must create a resource file for each language like for example: MUI.resx (that's the neutral one), MUI.fr.resx, MUI.es.resx, and you are going to use them in the web pages like this: MUI.keyword , that's if you are going to have one resx per language for all pages, you could also have one resx per language per webform.
And the current language is in the System.Threading.CurrentThread.CurrentUICulture
google it a little bit you will find more, at least now you know what to look for

Best way to encapsulate component that includes logic and webforms

I have written a data browsing library that is being used in several projects. The library or component includes some classes as well as some ASPX pages.
Until now, we copy all the files into each project to reuse it, with the obvious drawbacks and updating nightmares. I want to encapsulate all the library into a component that the projects can use.
What's the best way to do it? I know I can create a DLL, but I think it's only for the classes, don't know how to go with the ASPXs pages.
We are using Visual Studio 2008 and Framework 2.0
Thanks in advance
This is a perfect case for custom controls.
Change the pages into user controls, and embed the new user controls back into pages that have nothing in them but the reference to the user control.
Once that works, you can change the user controls into server controls, little by little. They will be composite controls, as the user control already is.
There's a trick you can use at this stage: I'm not recalling the details this late at night, but someone else will fill those in: when ASP.NET compiles a page, it first "compiles" the markup into source code, then compiles the source code. You can get ASP.NET to not delete the temporary source files. That allows you to copy into your project code that creates precisely the same HTML as the user control did.
The difference will be - it's now your code and you can refactor it as much as you like, or even include it in a custom control library.

Resources