Tag Archives: C#

ReportViewer Error : Operation is not valid due to the current state of the object

I was getting this error in my ASP.NET application when I try to load a report into the report viewer control. To solve this I used the Reset() method of the report viewer control.

oReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
oReportViewer.Visible = True
oReportViewer.ServerReport.ReportServerUrl = New System.Uri(sReportServiceURL)
oReportViewer.ServerReport.ReportPath = sReportName
oReportViewer.ShowParameterPrompts = False
oReportViewer.ShowDocumentMapButton = False
oReportViewer.DocumentMapWidth = 0
oReportViewer.ShowDocumentMapButton = False
oReportViewer.ShowFindControls = False

Leave a comment

Posted by on September 27, 2012 in Programming


Tags: , , , , , , , , , ,

Malahide Beach

Programming Languages

What do you use for programming? I mainly use VB.Net, I used and enjoyed C#. And as a web developer I used JavaScript. I remember doing some php long time ago. In the university I used Assembly, Fortran, and VB 6.0

But I only speaks two languages

Malahide Beach

Malahide Beach

Leave a comment

Posted by on September 23, 2011 in Photography


Tags: , , , , , , , , , , ,

Using ASP.NET Mobile Forms

I wanted to use the normal ASP.NET Forms stuff in a mobile form.

  • Right click on the web site project and select Add new Item


  • Select Mobile Web Form. enter a name for the form and click on Add button


  • To use a style sheet & a JavaScript file, I added a DeviceSpecific with SupportJavaScript Filter. this is how the HTML code looks like


  • Now I wanted to created some ASP controls. so I added another DeviceSpecific with isHTML32 Filter. this is how the HTML code looks like



  • One last thing, in order to make those DeviceSpecific Filters to work you need to add the required keys in the web.config file. this is how this would look like



Posted by on February 5, 2010 in Programming


Tags: , , , , , , , , , , , , , , ,

GridView: Wrong Fields Order


I was working on a GridView that is binding to a custom class collection to display its properties. the fields in the GridView were ordered depending on the order of the properties in the Class. everything was working fine. until I moved the code to a different development environment.

In the new development environment the order of the GridView fields was not as expected. after spending a lot of time trying to fix that. I installed the .NET 2.0 service pack 2 and that solved the problem!!!!

You can download the .NET 2.0 SP2 from here

Leave a comment

Posted by on January 27, 2010 in Programming


Tags: , , , , , , ,

C#:Using Dictionary as DropDownList Data Source

I have IDictionary Object called ListOptions. To use it as the data source for an ASP.NET DropDownList called objDropDownList:


objDropDownList.DataSource = ListOptions;

objDropDownList.DataTextField = “Value”;

          objDropDownList.DataValueField  = “Key”;





Leave a comment

Posted by on March 31, 2009 in Programming


Tags: , , , , , , , , , , , , , ,

How to sort a collection to be used in DropDown List

I have a collection object (EmployeesCollection) for custom Employee class, In the Employee class there are two properties Name and EmployeeID. I want to sort the EmployeesCollection by Name and use it in a DropDown List (ddEmployees).


DataTable dtEmployees = new DataTable();



          foreach (Employee vEmployee in EmployeesCollection)


                    dtEmployees.Rows.Add(new object[] { vEmployee.Name, vEmployee. EmployeeID  });


          dtEmployees.DefaultView.Sort = “Name”;

          ddEmployees.DataSource = dtEmployees;

          ddEmployees.DataTextField = “Name”;

          ddEmployees.DataValueField = “EmployeeID”;






Leave a comment

Posted by on February 18, 2009 in Programming


Tags: , , , , , , , , , , , ,

Getting the Table Name of a field in a View (SQL2000, C#)

So I have a View that join different tables, I wanted to get the Table name of a Field in the View. So I created a Function [GetTableName] with the following Inputs


         View Name

         Connection String of the View.

         The required Field Name


This is the function


public string GetTableName (string ViewName, string ConnString, string FieldName)


            SqlConnection MyConnection;

            string toReturn = ViewName;


            MyConnection = new SqlConnection(ConnString);



            DataTable MyTable = MyConnection.GetSchema(“Views”);

            foreach (DataRow dRow in MyTable.Rows)


                object[] sqlArray = dRow.ItemArray;

                if (sqlArray.GetValue(2).ToString() == ViewName)


                    DataTable MyVTable = MyConnection.GetSchema(“ViewColumns”);

                    foreach (DataRow dVRow in MyVTable.Rows)


                        object[] sqlVArray = dVRow.ItemArray;

                        if (sqlVArray.GetValue(2).ToString() == ViewName)


                            if (sqlVArray.GetValue(6).ToString() == FieldName)


                                toReturn = sqlVArray[5].ToString();










            return toReturn;





Leave a comment

Posted by on October 10, 2008 in General, Photography


Tags: , , , , , , , , , , , , , ,

%d bloggers like this: