Posts

Donate

Add Dropdown Or Select Control With OnchangeEvent To Bootstrap-Table Wenzhixin In ASP.NET Core MVC

Image
Hello and Good day! In this blog post I will demonstrate on how to add a select or dropdown control in Bootstrap-Table by Wenzhixin with an OnChange() event in ASP.NET Core MVC. For this tutorial, I will only fetch records from a List variable with fake information and not from a database for simplicity sake. To begin create an ASP.NET Core MVC using Visual Studio that targets the .NET 5 Framework and perform the rest of the steps below. I. Project Setup A. Add via libman the Bootstrap-Table by Wenzhixin using CDN as the option. B. Add via libman font-awesome using CDN as the option. C. Add the latest tableExport.js to bootstrap-table folder. D. Add Nuget Package Microsoft.AspNetCore.Mvc.NewtonsoftJson 5.x E. Add a new class in the Models folder called Product.cs Here's the project structure. II. Coding The Project A. Product.cs - Add properties that describe a product. The status property is where the Dropdown of the Boostrap-Table is bound to. public class Product {

How To Align Table Columns Inside A Detail View With It's Parent Bootstrap-Table Columns In ASP.NET MVC

Image
Good evening, When working with Detail View option in Bootstrap-Table by Wenzhixin, there's a possibility that you have to render the details information using a table element to the detail view with same number of columns and headers of the parent table as per client request. However, upon rendering the details view with the table element, the child table's columns are not aligned with the parent Bootstrap-Table such as the sample screen below. I tried different solutions such as CSS, jQuery/JavaScript and MutationObserver Pattern which work for a few details view and the rest would be in disarray. Before presenting the solution, here are the codes involved in this project. Bootrap Table With data-detail-view property enabled. <table id= "tblDetailsReport" class= "TableBorderCollapse table-striped" data-toggle= "table" data-sort-name= "JobNumber" data-sort-order= "asc" data-search= "t

Install And Integrate Tailwind CSS 3.0 In ASP.NET Core MVC 5.0 Web Application

Image
Hi Felas! In this post, I will now demonstrate on how to integrate Tailwind CSS into an empty ASP.NET Core 5.0 MVC Web Application and the steps used where taken from my previous post on How To Install Tailwind CSS 3.0 Using Tailwind CLI And Visual Studio Code In Your Web Project Project Setup 1. Create a new ASP.NET Core MVC project using Visual Studio 2019. 2. Once created, add two empty css files called input.css and output.css inside the css subfolder of wwwroot. 3. In your _Layout.cshtml page, comment out or remove the code that references both the bootstrap.min.css and site.css files. 4. Replace that with output.css. For now this is just an empty stylesheet file and after the CLI build is done, this file will be populated with Tailwind css codes. Installing Tailwind CSS using CLI command 1. Open Package Manager Console in Visual Studio 2019 (Tools -> NuGet Package Manager -> Package Manager Console). 2. Run create package.json command. This will eventually ad

How To Install Tailwind CSS 3.0 Using Tailwind CLI And Visual Studio Code In Your Web Project

Image
Hello and Good afternoon! In this post, I will demonstrate on how to install Tailwind CSS 3.0 which is the latest version as of this writing using Tailwind CLI and Visual Studio Code Terminal. The steps presented in this article are derived solely from the documentation which is then applied to an empty web project using Visual Studio Code IDE and it's built-in terminal. This framework was introduced to me by a ex-colleague of mine who's now focused on working with the latest front-end JavaScript and CSS frameworks. According to the documentation, Tailwind CSS is a highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override. In a nutshell, it is a utility-first CSS framework for rapidly building custom designs. Ok enough talk and let's get down to business. 1. Create a projects folder called test-project with three subdirectories namely cs

Remove Last Character Of A String From StringBuilder Added Using AppendLine() In C#

Image
Good afternoon! In a situtation where you add string values to a StringBuilder object using the AppendLine() method and you want to delete the last character, you might expect that using the Remove() method in the code below will work. But the truth is it does not. private static void RemoveLastCharacter() { StringBuilder sb = new StringBuilder(); sb.AppendLine( "Lorem ipsum dolor sit amet, consectetur adipiscing elit," ); sb.AppendLine( "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." ); sb = sb.Remove(sb.Length - 1, 1); Console.WriteLine(sb.ToString()); } Using Appendline() method to populate the StringBuilder object according to the documentation will also append the default line terminator after the string value to the end of the StringBuilder instance. Since the default line terminator has two characters specifically "\r\n", we need to include those two characters plus the last character of the string. The revise

How To Send Or Upload A Form With Multiple Files Using HttpPostedFileBase Array, jQuery And Ajax In ASP.NET MVC

Image
Good evening, This blog post demonstrates on how to upload or send a form with multiple files using HttpPostedFileBase class which is a property of a model class using jQuery and ajax in ASP.NET MVC. Given a sample model, I have declared a HttpPostedFileBase array property which is responsible for handling multiple files. public class clsWeeklyStatusReports { public Guid ID { get ; set ; } public string DomainName { get ; set ; } public string EmployeeName { get ; set ; } public DateTime SubmissionDate { get ; set ; } public string SubmissionDateDisplay { get { return SubmissionDate.ToString( "MM/dd/yyyy" ); } } public string MimeType { get ; set ; } public string FileName { get ; set ; } public HttpPostedFileBase[] Files { get ; set ; } public clsWeeklyStatusReportsGM() { ID = Guid.Empty; DomainName = string .Empty; EmployeeName = string .Empty; MimeType = string .Empty; FileName = string .Empty

Set Focus Or Auto Focus Input Control Using Inserted And Directive Not Working In Vue.js 3

Hello, Given the input element with an autofocus directive that on page load, this control get's focused right away. <input v-autofocus :class= "{ 'error' : empname.length > 22 }" /> The code to automatically focus the control is shown below using the inserted() method. directives:{ autofocus: { inserted(el){ el.focus(); } } } For some reasons the code above does not work in Vue.js 3x. After reading the docs, the solution that work was to use mounted() function instead of inserted() method if you're using Vue.js 3x. directives:{ autofocus: { mounted(el){ el.focus(); } } } Cheers!

How To Show Or Hide node_modules Folder In Visual Studio Code Editor

Image
Good evening! After adding the node modules using 'npm i' command in a Quasar or Vue.js project, I needed to show that folder in Visual Studio Code project explorer window since it's part of the project. Some of the solutions provided was to add some json configuration in settings.json which did not work. The solution that worked for me was to alter changes in Visual Studio Code Preferences itself. To proceed, go to File -> Preferences -> Text Editor -> Files and scroll down to locate the Exclude pane. Hover to the node_modules value and click the 'Remove Exclude Item' button. After that, the node_modules folder appears in the project explorer window. Cheers!

Notepad++ Plugin GetText Method Not Getting Entire String In C#

Image
Good evening, We have this Notepad++ Plugin project that will read and parse an html document converted from a MS Word file and then change the html string into an Adobe In Design format. The issue is that the html document has over 20,000 plus lines even reaching 40,000 lines or more. The code below will get all the text from an active Notepad++ window but fails if the string content is huge. public unsafe string GetText( int length) { byte [] textBuffer = new byte [10000]; fixed ( byte * textPtr = textBuffer) { Win32.SendMessage(scintilla, SciMsg.SCI_GETTEXT, (IntPtr)length, (IntPtr)textPtr); return Encoding.UTF8.GetString(textBuffer).TrimEnd( '\0' ); } } After doing some debugging and troubleshooting, I found a solution that is to replace the size of the textBuffer variable from a static value 10000 to the actual length passed into the function parameter. public unsafe string GetText( int length) { byte [] textBuffer = new byte [length]; fix

Creating Your First Notepad++ Plugin Using Visual Studio 2019 And C#

Image
Hello, In this blog post, I'll demonstrate on how to develop a Notepad++ Plugin (64 Bit) using Visual Studio 2019 and C# assuming that you have installed a 64 Bit version of the latest Notepad++ Editor. This tutorial is based from kblisted Notepad++ Plugin Package in GitHub . The plugin's architecture can communicate with the Notepad++ or the underlying Scintilla engine using NotepadPlusPlusGateway and ScintillaGateWay and Win32 API. To start with, download the Notepad++ Plugin Pack from the GitHub page and copy the zip file to the Project Templates folder of your Visual Studio 2019 IDE. In my laptop, the path is "C:\Users\my_username\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#" . Open your Visual Studio 2019 IDE and create a project using the Notepad++ Plugin template. Change the Platform Target to x64. (Our OS is Windows 10 64 bit) Create a function called SetFirstCharAllWordsCap inside Main.cs that get's the entire string content

Donate