Monday, December 17, 2012

How to Conditionally show any control in ASP.NET (Design View)




Most of the times we want to display an item from a database that may or may not have an associated download file link or image etc.

For example: you have different notices to be displayed on website, few of those notice records in database are having downloadble file (in db) and others may not have. and you want to display DOWNLOAD Link only where downloadble file exists in the database record.

If you bind the hyperlink to an control you can toggle the Visibility property from true to false, depending on the existence of an hyperlink, or image file path in the returned records. Following code can be used for the same.


C#:

Visible='<%# Eval("filePath")==DBNull.Value ? false: true %>'  


VB.Net



Visible=<%# IIf(Eval("filePath") Is DbNull.Value, "False","True") %>'




Sunday, December 2, 2012

How to Import Large Database Backup in WAMP by Increasing Import size in WAMP or Phpmyadmin



By default PHP Engine in WAMP supports/provides import size of database file is of 2mb. In case we want to import a large database i.e. database size greater than 10mb or 40mb etc.

The following steps can be followed to import large database size in wamp. We need to edit the PHP.INI file and after saving the changes, must restart all the services of WAMP.



Open PHP.INI files (C:\wamp\bin\php\php5.3.5 and C:\wamp\bin\apache\Apache2.2.17\bin) and perform following in both files:

1. Locate upload_max_filesize (use ctrl + F) and set it to as large as you need.

        For example upload_max_filesize = 100M (M denotes Mb).

2. Locate post_max_size and give it a larger value than upload_max_filesize.
        For example post_max_size = 120M (greater than upload size).

3. Locate memory_limit and give it a larger value than both of above.

        For example memory_limit = 140M