Use unobtrusive validator with AngularJs

Create a Directive called ‘validateit’ in Angularjs
and call ‘validateit’ directive in submit button.

PsAdminApp.directive('validateit', function () {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on("click", function (e) {
$('form').each(function () {
var $el = $(this);
$'validator', null);


Submit button code

<input type="submit" name="submit" value="submit" validateit />

Looking For Tips On Understanding How Video Game Cheat Codes Work? Check These Out

The video game world allows you to be just about anything you can imagine. You can go places you would never be able to see in reality, and you can do things that you never dreamed possible. To do all of this effectively, though, you need some good tips and tricks to help you navigate the world of video games. Turn on the subtitle function. Is it the cast that the dialogue of the game is hard to understand because of all the gunfire and music? Continue reading

Internet Design Made Easy: What You Need To Know

Do you wish to develop a fantastic internet site? Do you recognize what it is that makes a wonderful internet site? It’s internet style. Without appropriate internet design, your site could not do along with you hope. Don’t worry though because this write-up could assist. The information here can detail just what enters an excellent internet web site design. Continue reading

Add group product in cart magento

$productModel = Mage::getModel('catalog/product');
$super_group = array();
$parentId = $params['productid'];
$qty = 1;
// $parentId =  
$parentProduct = $product_model-&gt;load($parentId);
$associatedProducts = $parent_prod-&gt;getTypeInstance()-&gt;getAssociatedProducts();
//set quantity of associate product
 foreach ($associatedProducts as $product) {
            $array[$product-&gt;getId()] = $qty;
$params['super_group'] = $array;
$product = Mage::getModel('catalog/product')-&gt;load($parentId);
//check product availability
if (!$product) {
                echo "Error";
// create cart object
 $cart = Mage::getModel('checkout/cart');
$param = array('super_group' =&gt; $super_group);
 //Add product to cart with specified parameters 
$cart-&gt;addProduct($product, $params);
//and save the cart object
//update cart

Hide .php file extension from url using .htaccess

1. Paste this code in .htaccess file and change “yoursiteaddress” to your website address

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ "http\:\/\/www\.yoursiteaddress\.com\/$1" [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1/ [R,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php
RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301,L]

Remove index.php from magento store url

1. open .htaccess file from the root folder
2. Add following code in .htaccess file.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

3. system > configuration from admin panel select web.
4. again select Search Engines Optimization.
5. make Use Web Server Rewrites Yes.
6. at last don’t forget to flush Magento cache.

Date Validation In Datagridview

Validate Date in particular cell

private void dgvBreakageExp_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
if (dgvBreakageExp.Columns[e.ColumnIndex].Name == "InvoiceDate" || dgvBreakageExp.Columns[e.ColumnIndex].Name == "ExpDate")
if (e.FormattedValue == null || e.FormattedValue.ToString() == "")
dgvBreakageExp[e.ColumnIndex, e.RowIndex].ErrorText = null;
bool res = ValidateDate(e.FormattedValue.ToString());
if (res == false)
dgvBreakageExp[e.ColumnIndex, e.RowIndex].ErrorText = "Invalid Date,Date Should be('DD/MM/YYYY')";
e.Cancel = true;
dgvBreakageExp[e.ColumnIndex, e.RowIndex].ErrorText = null;
e.Cancel = false;
//function for validate the date and return true or false
private bool ValidateDate(string date)
DateTime Test;
if (DateTime.TryParseExact(date, "dd/MM/yyyy", null, DateTimeStyles.None, out Test) == true)
return true;

 return false;
 return false;

Custome DataGridView with Row Number and Alternate Row Color

class InfynetDgv : DataGridView
 protected override void OnRowPostPaint(DataGridViewRowPostPaintEventArgs e)

// get the row number in leading zero format,
 // where the width of the number = the width of the maximum number
 int RowNumWidth = this.RowCount.ToString().Length;
 StringBuilder RowNumber = new StringBuilder(RowNumWidth);
 RowNumber.Append(e.RowIndex + 1);
 while (RowNumber.Length < RowNumWidth)
 RowNumber.Insert(0, "0");
 // get the size of the row number string
 SizeF Sz = e.Graphics.MeasureString(RowNumber.ToString(), this.Font);
 // adjust the width of the column that contains the row header cells
 if (this.RowHeadersWidth < (int)(Sz.Width + 20))
 this.RowHeadersWidth = (int)(Sz.Width + 20);
 // draw the row number
 e.RowBounds.Location.X + 15,
 e.RowBounds.Location.Y + ((e.RowBounds.Height - Sz.Height) / 2));


protected override void OnCellFormatting(DataGridViewCellFormattingEventArgs e)
 var dataGridView = this;

e.CellStyle.Font = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular);
 this.AlternatingRowsDefaultCellStyle.BackColor = Color.FromArgb(212, 255, 212);
 if (dataGridView.Rows[e.RowIndex].Selected)
 e.CellStyle.Font = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold);
 e.CellStyle.SelectionBackColor = Color.FromArgb(123,123,123);
 DataGridViewCellStyle style = this.ColumnHeadersDefaultCellStyle;

style.BackColor = Color.FromArgb(137,137,137);
 style.ForeColor = Color.White;
 style.Padding= new Padding(3,3,3,3);
 style.Font = new Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold);



TextBox TextChanged Event on DataGridView Cell

private void dgvPurItem_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
 int colIndex;
 int rowIndex;
 var txtBox = e.Control as TextBox;
 colIndex = dgvPurItem.CurrentCell.ColumnIndex;
 rowIndex = dgvPurItem.CurrentCell.RowIndex;
 if (e.Control is TextBox)
  if (txtBox != null)

   txtBox.CharacterCasing = CharacterCasing.Upper;
   txtBox.TextChanged += new EventHandler(ItemTxtBox_TextChanged);
   txtBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
   txtBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
   txtBox.AutoCompleteCustomSource.Add("Item 1");
   txtBox.AutoCompleteCustomSource.Add("Item 2");
   txtBox.AutoCompleteCustomSource.Add("Item 3");

Continue reading