Skip to main content


Showing posts from 2012

Multiview Controller in c# with dotnetnuke or DNN

Dear All,
I hope every one worked with this control before with .net, yesterday i just use with DNN and i want to share this with you to use the Multiview controller with the control files.

Step1:  Register your controls

<%@ Register Src="~/DesktopModules/BV Admin GenerateForm/Admin_GenerateForm_01_SelectCustomer.ascx" TagName="step1" TagPrefix="ke" %>
<%@ Register Src="~/DesktopModules/BV Admin GenerateForm/Admin_GenerateForm_02_AddParent.ascx" TagName="step2" TagPrefix="ke" %>
<%@ Register Src="~/DesktopModules/BV Admin GenerateForm/Admin_GenerateForm_03_AddChild.ascx" TagName="step3" TagPrefix="ke" %>
<%@ Register Src="~/DesktopModules/BV Admin GenerateForm/Admin_GenerateForm_04_formPreview.ascx" TagName="step4" TagPrefix="ke" %>
<%@ Register Src="~/DesktopModules/BV Admin GenerateForm/Admin_GenerateForm_05_SucessMessage.ascx"…

Error encountered while copying audio stream In Adobe Captivate

Dear Users,

1. Close Captivate
2. Run 'command prompt (cmd)' in Admin mode
3. Go to the directory where Captivate-4 is installed
4. Run 'regsvr32 NSAudio.dll'
5. You should get a message 'registration of dll successful'
6. Now launch Captivate-4 again and execute your test.

Regards  Rashid Imran Bilgrami

How to duplicate the last record through SQL query

Dear Readers,
Today i share a code which may be help you out once in a blue, last few days back i found i request from my customer about duplicating the record in to new case for saving the time.

I have done this through query and i want to share this with you, I hope it will save your time.

( field1, field2, field3,...)
SELECT top(1) field1, filed2, filed3, ...  FROM Table_Name  WHERE primaryKey = yourvariable

Make sure do not include the primary key + autonumber field in this query.

Also you need to make sure the sequence of the inserting field (field1, field2, field3...) will be in same sql field sequence

If you want to add any variable in the field here is the sample query
Declare @var1 int
Declare @var2 int
Set @var1 = 1
Set @var2 = 2
insert into Table_Name(field1, field2, field3,...)
select * Column_Name, @var1, @var2  from second_table where condition

I hope it save your time

Rashid Imran Bilgrami

Complete Code for Data List & Button Click Event

Dear All
Here is a code for datalist with image / link button control. Also you can get the value of record id when you click on the button under the datalist item

Your Ascx file 

<asp:DataList ID="DataList1" runat="server" Width="100%" OnItemCommand="Your_Function_Name">
 <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="/DesktopModules/Tarahum Admin CP - Add New Case/images/deleteNew.png" CommandName="del" CommandArgument='<%#Eval ("recID") %>' />

Note: Command Arugement is the value that you need to pass on button click and command name is a unique name of this control for code behind

Code Behind Function

 protected void Your_Function_Name(object source, DataListCommandEventArgs e)

            if (e.CommandName == "del")
string recordID = e.CommandArgument.…

itemcommand not working or firing in datalist or datagrid or gridview

Dear All
I normally use this item command for enabling the editing through the Datalist control, right now i spend 4 hours because i didn't get why the itemcommand is not working when i click on the delete button under the Item template then i found the solution

I have done the stupid mistake

 if (!IsPostBack)
                // your loading function
 // My silly mistake i reload the datalist so remove this from your code it will work fine

Rashid Imran Bilgrami

A critical error has occurred. Invalid postback or callback argument

Dear All

Just now i got one error that arrives on clicking on the button under the item template

A critical error has occurred. Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

Here is the solution
Add the following line under web.config page
<pages enableEventValidation="false"/>

if you are using dnn then change the page line with the below line i change true to false
    <pages validateRequest="false" enableViewStateMac="true" enableEventValidation="false" …

Set value in item template control (Label, hidden field or any other)

Dear All,
It's a small thing but may be it helps you out, In the below example you did not want to go on code behind to set the value of hidden field just set the value directly through the ASCX databind option

I consider you already bind the data in your data list, here is an example for binding the recID value in controller

<asp:HiddenField ID="hfReserved" runat="server" Value='<%#Eval ("recID") %>' />
<asp:ImageButton ID="imgbtnSeat" runat="server" ImageUrl="Images/idlechair.png" CommandArgument='<%#Eval ("recID") %>' CommandName="Change" />
Rashid Imran Bilrgrami
CEO Best visualization

Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list (Tested / Resolved)

Dear Friends
If you facing the issue regarding to

Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list

in your .net 4.0 frame based  please run this command to get rid of above mentioned error

For 64 bit windows
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

If I had been on a 32 bit system, it would have looked like the following:
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i

Note: Make sure you can run the command prompt with Administrative right. 

Rashid Imran Bilgrami
Best visualization 

Create multi pages with dnn in one time

Dear All,
This created goes to one of my new join employee name Fahad Asghar, he find the new thing in dnn that makes the life easy for making the multi pages in one go..

Here is the solution

1) Login with your DNN website
2) Click on the Page Link at the top bar
3) Write all page name under the page management text area

here is the criteria for the pages

Root Page 1
Root Page 2
>Sub Page 1 Root Page 2
>Sub Page 2 Root Page 2
>>Sub Page 1 of Sub Page 2
>>Sub Page 2 of Sub Page 2

and so on, so you can made different page hierarchy  in one go with dnn

Thanks again for Fahad

Rashid Imran Bilgrami

Multi chart with Google Chart API Method 2

This method is very simple as compared to previous one

<!-- Graph Script Strat-->

<!-- Call Google API -->
 <script type="text/javascript" src=""></script>

// Create graph package
    <script type="text/javascript">
        google.load('visualization', '1', { packages: ['corechart'] });

    <script type="text/javascript">
//  Write my own function

        function drawVisualization() {
            // Create and populate the data table.
          var data = google.visualization.arrayToDataTable([
          ['Required Money', 'Number Of People'],

//  assigning the value from the code behind
          ['Up to 500 SAR', <asp:Literal ID="v1" runat="server"></asp:Literal>],
          ['Up to 500 to 1,000 SAR', <asp:Literal ID="v2" runat="server"></asp:L…

Multi chart with Google Chart API

Hi friends,
Today i am sharing how you create a multi chart with Google API  in single page. The code is defined below:

        <title>Google Charts Tutorial</title>

        <style type="text/css">
            #eventsExample {
                position: relative;
            #details0, #details1, #details2, #details3 {
                background: #FFFF7F;
                border: solid 1px;
                width: 350px;
                padding: 5px;
                top: 250px;

        <!-- load Google AJAX API -->
        <script type="text/javascript" src=""></script>
        <script type=&quo…

How to access control under header template in c#

Hi every one
I do the following code for accessing the user control in datalist header

Here is the code for you
Control HeaderTemplate = DataList1.Controls[0].Controls[0];
DropDownList myDropdown = HeaderTemplate.FindControl("DropDownList1") as DropDownList;


Rashid Imran Bilgrami
Best visualization

Dynamically loading an external JavaScript or CSS file For Ajax mobile apps

Hi every one,
If you want to load the js or css file after the page load or after the document.readystate then you must follow the following underneath functions

To load a .js or .css file dynamically, in a nutshell, it means using DOM methods to first create a swanky new "SCRIPT" or "LINK" element, assign it the appropriate attributes, and finally, use element.appendChild() to add the element to the desired location within the document tree. It sounds a lot more fancy than it really is. Lets see how it all comes together:

function loadjscssfile(filename, filetype){
 if (filetype=="js"){ //if filename is a external JavaScript file
  var fileref=document.createElement('script')
  fileref.setAttribute("src", filename)
 else if (filetype=="css"){ //if filename is an external CSS file
  var fileref=document.createElement("link")

How to create Nested Data list, data grid or data repeater simple

Dear All,
The simplest way of create nested datalist with parent child table relation is given below:

 protected void loadData()
           //Note: For Define your connection string i am not writing it because it is in my web.config and i load it through my internal class

             DataSet ds = new DataSet();
          // my private class that contains sql execute funtions, I pass the SQL parameters and Values through array
            UDF myudf = new UDF();
            string spName = "bvs_payInvoice";

            string[] field = new string[5];
            string[] fieldValue = new string[field.Length];

            field[0] = "@startDate";
            field[1] = "@endDate";
            field[2] = "@searchType";
            field[3] = "@keyWord";
            field[4] = "@status";

            fieldValue[0] = startDate;
            fieldValue[1] = endDate;
            fieldValue[2] = searchType;

IIS 7 corrupted applicationHost.config (Configuration file is not well-formed XML)

Hi Every one!
Today i found a new experiences, my IIS suddenly crashed and  it gives me the error

The Windows Process Activation Service encountered an error trying to read configuration data from file ‘\\?\C:\Windows\system32\inetsrv\config\applicationHost.config’, line number ’0′. The error message is: ‘Configuration file is not well-formed XML’

What i can do simple these step to get rid of this issue

The error made because applicationHost.config files are corrupted.

First you can copy the backup files from

C:\inetpub\history\get the latest history folder

copy the file
a ) administration.config
b) applicationHost.config

and past is in to this location

Restart IIS with your dos command iisreset

and your problem will resolved

Rashid Bilgrami
Best visualization

Simple script to backup all SQL Server databases

Original Post
ProblemSometimes things that seem complicated are much easier then you think and this is the power of using T-SQL to take care of repetitive tasks.  One of these tasks may be the need to backup all databases on your server.   This is not a big deal if you have a handful of databases, but I have seen several servers where there are 100+ databases on the same instance of SQL Server.  You could use Enterprise Manager to backup the databases or even use Maintenance Plans, but using T-SQL is a much simpler and faster approach.
SolutionWith the use of T-SQL you can generate your backup commands and with the use of cursors you can cursor through all of your databases to back them up one by one.  This is a very straight forward process and you only need a handful of commands to do this.  Here is the script that will allow you to backup each database within your instance of SQL Server.  You …

Login Problem After DNN database Restoring

Dear All
If you are facing the problem in login after restoring database the reason is the machine key is not matching.

This problem arrived because you are restore the whole website from server to workstations so because of this you will face two problems

1) Login accounts not working
2) Pages will not show

for 2nd problem please check my previous blog

for login you need to resolve it like this

1) Register with the normal user
2) Open the database table users
3) Assign this user as super host  (Please read this post if you don't know about this step
4) Close the database
5) Login with the new user
6) Go to admin > user accounts
7) Click on the pencil and click on password manager
8) Click on the Reset password (system generated random one)
9) Once it done you can assign your own password

After that you…

How to assign db custom schema in sql server

Dear All,
In last days, i spend allot of time in identify the solution of assigning custom schema in sql server, specially when you restore any database which have a custom schema you face lot of problems here is the solution

1) Take a back of your database from online server
2) Restore in to destination place
3) Create a new user in SQL server (in Global security section)
4) Provide login name in Login Name section
5) Provide the password as you need
6) Select the default database that you restore
7) Click on the user map  (Left side 3rd menu)
8) In the restore db row select user under the user column and select schema under the schema column
9) save and close as well as disconnected
10) login with the new created user your schema will work

Rashid Bilgrami
Best visualization

Display PHP Errors In IIS

Dear All
I used IIS and PHP from long time but today i just find one issue when i tried to display the PHP error in IIS it's show me blank page, if you face this issue use this  command and check your local php ini settings

Open your CMD (command or dos prompt)
Make your directory location to C:\
and copy past the below line

%windir%\system32\inetsrv\appcmd.exe set config -Section:system.webServer/httpErrors -errorMode:Detailed

Restart IIS


error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
display_errors = On

and if you logged these error
log_errors = On

I hope who are using PHP with IIS may be this post helpful for them

One more thing make sure when you are writing the code with IIS in PHP you must define

Rashid Imran Bilgrami
Best visualization

How to allow DNN register member or all members to upload the document and image in Text / HTML editor

Dear All,
Today i got a solution for a very simple solution, may be it save your time.

How to Enable Upload Image / Document option under the DNN Text / HTML editor for Register Members or Non register Members

Please follow following steps

1) Login with your host account
2) Go to Admin > File Manager
3) At the bottom of the page you will find the permission options
4) Allow write file to ALL Role or Register member Role

Login with the normal user and test it you will see the image upload option for every register member or non register member

Rashid Imran Bilgrami
CEO Best visualization

Convert your HTML Description to Plain text in C# ascx or aspx or code behind page

Replace html pattern to the below line

<% #Regex.Replace("Your String/ Your Text / Your DB Value" , html pattern, string.Empty)%>

Live usage 
<%#Regex.Replace(DataBinder.Eval(Container.DataItem, "descriptionVal").ToString(), @"<(.|\n)*?>", string.Empty) %>

I hope it helps you allot

Rashid Imran Bilgrami
Best visualization

How to read the latest post from facebook

Dear  All
As per promise i found the solution how to get the latest facebook feeds

you need the access token from this url

Get the Graph URL Page Name/feed?access_token=Your Access token&limit=5

Replace your page name with your facebook page name appears in the URL

Access token with your access token that you will generate from the above URL

and limit options to show the top 5 records

I hope it helps you allot

Rashid Imran Bilgrami

How to get facebook Page ID

Dear All
Facebook update the timeline interface and its really hard now to get the facebook page id before that it was in the URL now because of URL rewriting you can't get it. Today i found the way how you get the facebook page id and lot of things

FBL is the right place from where you can get your page ID through 
Example Query
You will get the ID ;) Enjoy 
My next post will be soon in which you will study how to get the latest facebook updated comments in your website 
Regards  Rashid Imran Bilgrami  Best Visualization

Allow DNN register members to create their own blog

Dear All,
This issue i have resolved long time back but forgot to enter in my blog, today i face this issue so i am writing it here to save your time :)

If you want to allow your dnn register member to create new blog under the blog module then the solution is very simple

1) Deploy Blog module
2) Once you deploy you will find lot of modules on the page, Go to the "New Blog" Module settings
3) Unchecked the inherit setting under the permissions
4) Check register member as view and edit

Now log out with host and logged in as register member to see the create blog link :)

Have a nice day

Rashid Imran Bilgrami
CEO Best visualization

Facebook Apps (How to add like button in your website)

Dear All
Today i am telling you how easily you add the facebook like button in your own website.

Go to this URL

and do the following steps

1) Provide URL
2) Set width
3) Set color scheme
4) Get code

Past this code in your HTML head tag between and your like button is ready

Rashid Imran Bilgrami 

Convert Bulk PSD files in to JPG

Dear All,
May be lot of people know about it.. I just get the info and share with you guys

Rashid Imran Bilgrami

Unable to save the dnn survey template or survey setting. or Survey settings are completely not saving

Dear All
If you are facing a problem to update the DNN survey module template, then the solution is very simple

Just update the latest release 4.7.01  the problem will resolve [This problem only arrive so far in dnn 6.x portals]

Best regards
Rashid Imran Bilgrami

Localization of module container title in DNN or Translate your DNN module Title In different Languages

Dear All
If you are looking for the translation of dnn container title then there are two solution

1) You can go with the appolo module which helps you to localize the HTML module title (for this see my prior post
2) If you are developing you own module then use (Specially thanks for Psturdee answer get through dnn forum
your module's Page_Init method:

protected void Page_Init(object sender, EventArgs e)
this.ModuleConfiguration.ModuleTitle = "Whatever you want your module title to be";

You can use Resource files to provide the strings with something like this:

protected void Page_Init(object sender, EventArgs e)
this.ModuleConfiguration.ModuleTitle = Localization.GetString("ModuleTitle", Localization.GetResourceFile(this, "YourModule.ascx");

then define in your resource files, "YourModule.ascx.[lang].resx", a name, "ModuleTitle.Text",


How to copy the fonts from Windows Fonts directory to Another Directory

Dear All
It's a small stuff but it make you crazy :)

when you tried to copy selected fonts from the windows folder its allow you to copy but when you tried to past in the destination folder the past option will be disable

the solution i found is very simple

Click on Edit under tool bar and select Copy to folder option

All selected fonts will be coping in new destination as well

Rashid Bilgrami

"Flickr error 2: Unknown user": Solved

Dear All
Today i tried to work with the flicker photos to save and retrive the pics from there and i got one great API but when i execute the code it gave me the error

"Flickr error 2: Unknown user":
After a google research, i wasn't able to find any thing i used my yahoo id there but its also not working

then i found one another id which you will see in the right side section of below link use this id and your code will work

make sure your id looks like some number with @N00 this is correct id

I hope this will help you in your project

Rashid Imran Bilgrami 

SQL Server and Arabic language

I have read some articles written about how some products like Office 2010 by default support not only Hijri Date but also support UmAlQura Date and this good news.

This article show you some points related to Arabic language (which is my mother tongue) with Sql Server. In general Sql server deals with any language in the same way except some issues become different from language to other language.
So let's begin by Collation and see how Sql Server stored data and retrieve data in Arabic language.

What is a Collation?
A collation determines the rules SQL Server uses to compare and sort character data and determines which characters can be stored in non-Unicode character data types. Collation can be specified at the instance level, database, column level or clause level. So let's begin by this example to make the points clear:

01.CREATE TABLE [dbo].[Test](
02.--here stored data as ASCII char
03.[Name_Char_Latain] [char](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
04.--here st…

SQL SERVER – 2008 – Creating Full Text Catalog and Full Text Search

Dear All;
Ref URL:

Full Text Index helps to perform complex queries against character data.  These queries can include word or phrase searching. We can create a full-text index on a table or indexed view in a database. Only one full-text index is allowed per table or indexed view. The index can contain up to 1024 columns. Software developer Monica who helped with screenshots also informed that this feature works with RTM (Ready to Manufacture) version of SQL Server 2008 and does not work on CTP (Community Technology Preview) versions. To create an Index, follow the steps: Create a Full-Text CatalogCreate a Full-Text IndexPopulate the Index1) Create a Full-Text Catalog
Full – Text can also be created while creating a Full-Text Index in its Wizard. 2) Create a Full-Text Index