Posts

SCRIPT5007: Unable to get value of the property '0': object is null or undefined - jquery.jqGrid.js

Image
If you try to create data grid using mvc jqGrid and somehow the error above occur while debugging script using IE Debugger. Please follow this step to fix it.. The error because of in your mvc jqGrid coding, you not specify the json reader. Just add this line of code in your View and also in your mvc jqGrid . The Solution @{                 MvcJqGrid.DataReaders.JsonReader jsonReader = new MvcJqGrid.DataReaders.JsonReader();                 jsonReader.RepeatItems = false;                 jsonReader.Id = "dataJson";             } @(Html.Grid("GridDataBasic")                 .SetCaption("List Of User")                 .AddColumn(new Column("AdminID"))                 .AddColumn(new Column("Email"))                 .AddColumn(new Column("Tel"))                 .AddColumn(new Column("Role"))                 .AddColumn(new Column("Active"))                 .SetUrl("/Home/GridDataBasic")             

Simple Image Galery in PHP - Example

Image
This post is a different from others post. because in this example i will use PHP language to create very simple Image Galery. The code will get list from image directory, and the build a image tag element in html to show the image. Very simple. Lets see the example. The  Project list Folder and file The PHP File  <html>     <body>                <h1>Image Gallery</h1>                <div style="width:640px;">             <?php             //change directory to image stored location             //if image is at another server try to do like this             //$dir = 'http://<server ip address>/<location at server>'             //make sure image is accessible             $dir    = 'Images';             $files1 = scandir($dir);                                   foreach ($files1 as $value) {                 if(strtoupper(explode('.', $value)[1]) == "JPG"){//make sure image is JPG or just remove this f

How to use PathGradientBrush WrapMode Property

Image
Here The code To Create Page like picture above. The code behind protected void Button1_Click(object sender, EventArgs e)         {             Bitmap bmp = new Bitmap(600, 300);             Graphics g = Graphics.FromImage(bmp);             g.Clear(Color.White);             GraphicsPath gPath = new GraphicsPath();             Rectangle rect = new Rectangle(0, 0, 100, 100);             gPath.AddRectangle(rect);             PathGradientBrush pathGradientBrush = new PathGradientBrush(gPath);             pathGradientBrush.CenterColor = Color.Crimson;             Color[] colors = { Color.Snow, Color.IndianRed };             pathGradientBrush.SurroundColors = colors;             pathGradientBrush.WrapMode = WrapMode.Tile;             Rectangle rect2 = new Rectangle(0, 0, 300, 300);             g.FillRectangle(pathGradientBrush, rect2);             pathGradientBrush.WrapMode = WrapMode.TileFlipXY;             Rectangle rect3 = new Rectangle(300, 0, 300, 300);             g.FillRectangl

Javascript - Inline Code VS External Files

Inline Code <html> <head> <script type="text/javascript"> function a() { alert('hello world'); } </script> </head> <body> : : </body> </html> External Files <html> <head> <script type="text/javascript" src="/scriptone.js"> </script> </head> <body> : : </body> </html> scriptone.js function a() { alert('hello world'); } As you can see from the above example,  what is the advantage to put all script in one file and just call it from html( External Code ) instead of just write it in html( inline code ).? The answer is here :  By using external code, the javascript code is much more maintainability :- javascript Code that is sprinkled throughout various HTML pages turns code maintenance into a problem. It is much easier to have a directory for all javascript files so that developers can edit JavaScript code independent of the markup in which it is u

Step by step how to create MVCJQGrid ASP.NET MVC4

Image
First step is to install MVCJQGrid in your project application(MVC). In This tutorial i will show you how to install MVCJQGrid using NuGet in Microsoft Visual Studio 2010. Install MVCJQGrid 1. In VS2010 open NuGet Manager. 2. Search MVCJQGrid and install the latest MVCJQGrid from NuGet Package Manager. Note : Recommended install latest version of JQGrid 3. Apply Installed NuGet Package into your project. Ok done the first step. Now your project already have MVCJQGrid package with it. Create your first Data Grid using MVCJQGrid First of all in order for you to start write MVCJQGrid coding, you need to add new namespace for the project. In This tutorial i will add the MvcJQGrid in web.config file : Web.Config File      <pages>           <namespaces>             <add namespace="System.Web.Helpers" />             <add namespace="System.Web.Mvc" />             <add namespace="System.Web.Mvc.Ajax" />             <add namespace

ReadOnly TextBox causes page back when enter backspace key

Image
As Mention in the title of this post, the browser behavior always think that user want to go back(to previous page) when back space key in entered. So for the read only text box, the edit mode for the text box is not enable hence the backspace key will cause page to go back to previous page. The solution is to put the JavaScript at the Read Only Text Box to prevent page from go back to previous page. The Script  function preventBackspace(e) {              var evt = e || window.event;              if (evt) {                  var keyCode = evt.charCode || evt.keyCode;                  if (keyCode === 8) {                      if (evt.preventDefault) {                          evt.preventDefault();                      } else {                          evt.returnValue = false;                          alert("This is a read only field");                      }                 }                  else {                      evt.returnValue = false;                      alert("

Change Default Browser for asp.net MVC

Image
Do you ever have problem to change default browser for Asp.Net MVC application? Here simple solution to change default browser for asp.net mvc application. Follow this step : Right click at solution explorer on mvc application and choose add new item. Choose "Web Form" file. Right click at web form file and choose browse with to change default browser for your asp.net mvc application. By Mohd Zulkamal NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)