Oct 25, 2020
Oct 18, 2020
Aug 2, 2020
Aug 1, 2020
Jul 27, 2020
Blazor - Build your first Blazor app
Kalpesh Satasiya
2:02 AM
.Net, Blazor, C#, First App
No comments
- Purpose
- Build your first web app with Blazor.
- Prerequisites
- None
- Time to Complete
- 10-15 minutes
- Scenario
- Create, use, and modify a simple counter component
Jul 26, 2020
Blazor - Build client web apps with C#
Kalpesh Satasiya
6:13 PM
asp.net, Blazor, Client Side C#
No comments
View is not updating values in Asp.Net MVC.
Kalpesh Satasiya
4:42 PM
Asp.Net MVC, ModelState, ModelState.Clear(), View not updating
No comments
I have recently facing this issues and I thought let me write blog on this topic so it will be helpful to others.
What was happen with me. I had developed a page couple of year ago and it was working fine.
And few days ago I was working on that page and suddenly that page behavior was changed after POST action.
I was tried to save data and return View(model) and also before View(model) there was a some changes on model.
I had debug and check model is updating fine but value is not reflect on View (.cshtml) page.
So I had tried other alternative solutions but it was not work.
Finally got the solution and issue with ModelState.
ModelState.Clear(); return View(Model);
Before return View written ModelState.Clear() and resolved the issue.
Hope this solution help to you.
Jul 20, 2020
How to handle large form in Asp.Net Core MVC
Kalpesh Satasiya
12:52 AM
Asp Net Core, Asp Net Core MVC, Large Form
No comments
It is just a simple configuration on Startup.cs file and there are only two line of code we need to add it.
public void ConfigureServices(IServiceCollection services) { services.Configure(x => x.ValueCountLimit = int.MaxValue); services.AddMvc(options => { options.MaxModelBindingCollectionSize = 1500; }); services.AddControllersWithViews(); }
Please below video for more detail.
Jul 12, 2020
Nov 25, 2019
Sep 28, 2019
Jul 27, 2019
Apr 24, 2019
Global Azure Bootcamp 2019
Kalpesh Satasiya
10:00 AM
Azure, BootCamp 2019, Global Azure Bootcamp
No comments
There is a full day events and are many sessions. All sessions about Azure technologies related.
This is the 7th year in a row, organizing Global Azure Bootcamp. Hope you was enjoyed previous Global Azure Bootcamp.
Once again we have opportunity to help to community and share knowledge with community people.
I will be talking on Azure Lab Services on Global Azure Bootcamp.
If you want to participate. Please register on below link.
https://www.eventbrite.com/e/global-azure-bootcamp-2019-by-ahmedabadusergroup-tickets-59582245099
Please find more information on https://global.azurebootcamp.net/locations/india-ahmedabad/
Jun 16, 2018
How to add dummy data into table using Laravel seeder
Kalpesh Satasiya
2:59 PM
Faker, Laravel 5, PHP, Seeder
No comments
Let's check the demo of how to add dummy data in category table using Laravel seeder.
First, you need to install faker into Laravel. Faker is a PHP library that generates fake data for you
Install faker using composer command
composer require fzaninotto/faker
After installing faker you can see in require dev parameter in composer.json file in Laravel as below
composer.json file has below configuration:
"require-dev": {
"fzaninotto/faker": "~1.4",
},
namespace App; use Illuminate\Database\Eloquent\Model; class Category extends Model { public $timestamps=false; }
1,category1, et sit et mollitia sed.
2,category2, et sit et mollitia sed.
etc into categories table.
use Carbon\Carbon; use Illuminate\Database\Seeder; use Illuminate\Support\Facades\DB; class CategoriesTableSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // DB::table('categories')->delete(); $faker = Faker\Factory::create(); for ($i = 1; $i < 20; $i++) { DB::table('categories')->insert([ 'CategoryName' => 'Category'.$i,'Description'=> $faker->text ]); } } }For the run, this CategoriesTableSeeder add this call into DatabaseSeeder class.
use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { /** * Run the database seeds. * * @return void */ public function run() { // $this->call(UsersTableSeeder::class); $this->call(CategoriesTableSeeder::class); } }
How to display category name in the product listing page using ORM in Laravel
Kalpesh Satasiya
2:40 PM
Laravel, ORM, PHP, RelationShip
No comments
I also facing the same issue so I have figured it out using the relationship.
Can't display category name in Product List page because of category and product both are the different entity so both data stored into a different table
For that, need to give a relationship between product and category.
Let's see below example
The relationship between category and product:
A product belongs to category and category hasMany products.
My Database:
Category: CategoryID, CategoryName - Here CategoryID is primary key
Product: ProductID, CategoryID, Product Name, Image, Status, Created date - ProductID is Primary key and CategoryID is reference key
Product Model:
namespace App; use Illuminate\Database\Eloquent\Model; class Product extends Model { public $timestamps=false; // default created_at and updated_at given so I passed as false; protected $fillable = [ 'category_id','product_name','image','status','created_date' ]; public function category() { return $this->belongsTo(Category::class); } }Category Model:
namespace App; use Illuminate\Database\Eloquent\Model; class Category extends Model { // public $timestamps=false; public function Product() { return $this->hasMany(Product::class); } }Once we have done with configuration model than see how to access category name in product listing template file.
Using below syntax it will display category name of that particular product.
{{$product->category->category_name}} -> Here category is relationship defined in product model.
create.blade.tpl
@if(count($product) > 0 ) @foreach ($product as $product) // You can access using category relationship in product model @endforeach @else @endif
Product Name | Category Name | Image | Status | Created Date |
---|---|---|---|---|
{{ $product->product_name}} | {{$product->category->category_name}} | @if ($product->status == '1') Active @else Inactive @endif | {{ date('F d, Y', strtotime($product->created_date)) }} | |
No Record Found!! |
public function create() { $product = Product::all(); $params = [ 'title' => 'Product Listing', 'product' => $product ]; return view('products.create')->with($params); }
May 13, 2018
How to load a component dynamically in Vue js
Kalpesh Satasiya
3:32 PM
Component, Dynamical Load, Vue, Vue.js
No comments
Sometimes require component load based on some criteria or condition. That time needs to load component dynamically.
The above is made possible by Vue’s
In the example above, currentTabComponent can contain either:
- the name of a registered component, or
- a component’s options object
Following are the full source code of the dynamic load component.
On the above code, we have two buttons one for Demo 1 and second for Demo 2 component.
Default Demo 1 component load and when press on Demo 2 button demo2 component load dynamically.
Click vice versa of Demo 1 and Demo 2 button and load appropriate component dynamically.
Hope you like the topic and useful to you.