Contents tagged with JavaScript
-
Client Side Form Validations Using TypeScript For Beginners
Validating a data entry form before submitting it to the server is one of the most common task in web applications. In ASP.NET Core you can easily do that with the help of validation attributes and tag helpers. However, at times you need to take charge of the client side validation process and roll out your own strategy to validate the data being submitted to the server. For example, you might be building a SPA and want to validate data using HTML5 features. To that end this article discusses how HTML5 form validation features can be used in TypeScript and ASP.NET Core.
-
Dealing with JSON serialization and camel casing in AspNet Core
ASP.NET Core Web APIs and controllers often need to serialize JSON data to JavaScript clients. On the server side your C# classes typically use Pascal Casing to name properties whereas JavaScript code often uses Camel Casing for property names. Therefore it would be worthwhile to take a quick look at how ASP.NET Core serializes data in JSON format from Web API and MVC controllers.
-
New Article and Video : Use Generics in TypeScript
In the previous part of this article and video series you learned about various types of decorators. Continuing our learning further this part discusses how generics can be utilized in TypeScript. If you are a C# developer chances are you already know generics. You can use that concept in TypeScript also. To that end this article discusses a few examples that show how to put generics to use in TypeScript classes and methods.
-
New Article and Video : Create property and method decorators in TypeScript
In the previous part of this article and video series you were introduced to TypeScript decorators. You know that decorators come in different flavors such as class, property, method, accessor, and parameter decorators. You also learned to create class decorators. Continuing our learning further this part shows you how to create property and method decorators.
-
Article and Video : Create class decorators in TypeScript
In the previous part of this article and video series you learned about TypeScript inheritance. In this article you will learn about a feature of TypeScript that allows you to annotate and modify classes and class members. This feature is called Decorators. Decorators is an experimental feature and you need to enable them in your TypeScript configuration file. You will find TypeScript decorators analogous to C# attributes in that they form the metadata of a class and class members.
-
Use inheritance, abstract classes, and polymorphism in TypeScript
Object oriented programming languages such as C# allow you to inherit functionality from base class. TypeScript also offers inheritance capabilities so that your classes can inherit from other classes. TypeScript doesn't support multiple inheritance (although your class can implement multiple interfaces). You can also create abstract classes - classes that can't be instantiated on their own; they must be inherited in other classes. In this article you will learn all these aspects of TypeScript inheritance.
-
TypeScript class for UI callback functions and the Web API
In the previous part of this article and video series you developed a TypeScript class that invokes an ASP.NET Core Web API using XMLHttpRequest object. Recollect from the previous part that the EmployeeApiClient class expects a few callback functions. These callback functions receive the response returned by the Employees Web API and display it on to the web page. In this part you will create another TypeScript class that houses those callback functions. You will also create the Employees Web API that performs the CRUD operations. Finally, you will test the functioning of both the TypeScript classes (and the Employees Web API) by calling their methods from a web page.
-
Upload Files Using jQuery Ajax and JavaScript Interop in Blazor
Uploading files from client machine to the server is one of the fundamental operations in web applications. In ASP.NET Core MVC applications you can accomplish this task easily using HTML5 file input field and server side logic. However, Blazor doesn't have any built-in facility (so far) for uploading files. You either need to use some third-party solution or device your own technique to accomplish the task.
-
Implement Two-way Data Binding in JavaScript
One of the fundamental features of modern JavaScript libraries and frameworks is data binding. The data binding features offered by them allows you to keep model and view in sync. Did you ever wondered how something similar can be implemented in plain JavaScript? If so this article shows you one such simple yet working implementation. Although simple implementation as discussed in this article is not intended to substitute what is offered by these libraries and frameworks, it will certainly give you a glimpse of how data binding might be implemented if needed.
-
Seven Ways of Creating Objects in JavaScript for C# Developers
As a C# developer building ASP.NET web applications you create classes and then use their objects in your application. In JavaScript, however, there are multiple ways to create objects. This article gives you a quick overview of these available options with an example of each.