Deploy ReportViewer 10 in Visual Studio 2010 to production site

.Net, SQL No Comments »

If you have developed a .Net 4 website in Visual Studio 10 that that uses a client reportviewer control, then you are likely to run into problems with running reportviewer on the production server. Here’s the steps to get it running:

  1. Install ReportViewer 10 on your production machine. Go to Microsoft Download Center and search for “Microsoft Report Viewer 2010”
    download and install to your production server
  2. publish website to production server
  3. on the development server go to
    [drive]:\Program Files\Microsoft Visual Studio 10.0\ReportViewer\
    and copy the following files to the “bin” folder of your live site:
    Microsoft.ReportViewer.Common.dll
    Microsoft.ReportViewer.WebForms.dll
  4. this is the tricky part, copying “Microsoft.ReportViewer.ProcessingObje
    ctModel.dll”
  5. on your production server open a Command Prompt window, then cd to [drive]:\Windows
  6. then dir /s Microsoft.ReportViewer.ProcessingObjectModel.dll to find the dll
  7. cd to assembly\gac_msil\microsoft.reportviewer.processingobjectmodel
    this path contained the 2 versions of the file:
    10.0.0.0__b03f5f7f11d50a3a
    9.0.0.0__b03f5f7f11d50a3a
    since I’m using VS2010, I need the version 10
  8. copy 10.0.0.0__b03f5f7f11d50a3a [drive]:\[path]\bin
  9. you will now see “Microsoft.ReportViewer.ProcessingObjectModel.dll” in your website’s bin folder, you’re good to go

Programmatically call ImageButton_Click

.Net, ASP No Comments »

with a regular button, you can programmatically call the Button_Click by calling:

Button1_Click(Me, EventArgs.Empty);

However, with an ImageButton, you get an error if you use the above method. You need an extra line of code:

ImageClickEventArgs args = new ImageClickEventArgs(1, 1);
ImageButton1_Click(this, args);

Sitefinity Custom Download List

.Net No Comments »

Problem: create a file-download-list that you can filter by tag, category, or other criteria

Solution:

  1. create a library and upload your files to it
  2. categories and/or tag the files the way you want them to be filtered
  3. download the following sample code from the Telerik team:
    http://www.sitefinity.com/ClientsFiles/143126_customdownloadlist.zip
    (for more information on this download refer to Telerik’s forum)
  4. add the following customizations to the supplied sample in order to filter by tags or categories:

            if (filterByTag)
            {
                tagFilter = new List<ITag>();
                IList<ITag> alltags = this.manager.GetTags().OfType<ITag>().ToList();
                foreach (Guid g in FromTags)
                {
                    foreach (ITag t1 in alltags)
                    {
                        if (t1.ID.Equals(g)) { tagFilter.Add(t1); }
                    }
                }
            }
            if (filterByCategory)
            {
                categoryFilter = new List<ICategory>();
                IList<ICategory> allcats = this.manager.GetCategories().OfType<ICategory>().ToList();
                foreach (Guid g in FromCategories)
                {
                    foreach (ICategory c1 in allcats)
                    {
                        if (c1.ID.Equals(g)) { categoryFilter.Add(c1); }
                    }
                }
            }

now you have a custom download list that filters by Tags or Categories.

I have only tried this code on a Sitefinity 3.7 Standard site, I don’t know if it is compatible with other versions.

Fix ASP.net menu in Safari and Chrome

.Net, HTML No Comments »

If you use the standard ASP.NET menu (or toolbar) in your web application, it works well in most browsers except for Safari & Chrome. In these 2 browsers, each menu item appears on a new line.

The fix I found was placing the following code in my MaterPage code-behind:
if (Request.UserAgent.IndexOf(“AppleWebKit”) > 0)
        {
            Request.Browser.Adapters.Clear();
        }

If you are not using a Materpage:
protected void Page_PreInit(object sender, EventArgs e)
    {
        if (Request.UserAgent != null && Request.UserAgent.IndexOf(“AppleWebKit”, StringComparer.CurrentCultureIgnoreCase) > -1)
        {
            this.ClientTarget = “uplevel”;
        }
    }

The solution is adapted from this site (Thank you):
http://weblogs.asp.net/joshuajohnson/archive/2008/01/23/how-do-i-overcome-the-dreaded-safari-asp-net-menu-conundrum.aspx

Silverlight on IIS 6

.Net, ASP No Comments »

In order to host a Silverlight application on IIS6 you will need to add a MIME type

  • Open IIS, right-click and select properties for the Silverlight site.
  • Select the tab for HTTP Headers
  • Click on MIME Types
  • Click New and add Extension= .xaml and Mime Type= application/xaml+xml
  • Depending on the features used in your Silverlight app, you might also need to add 2 new types of
    (.xap  application/x-silverlight-app) and (.xbap  application/x-ms-xbap)

UltraWebGrid Cell and CellItem

.Net No Comments »

if you have an UltraWebGrid with a TemplatedColumn, the TemplatedColumn has a checkbox or any other control. If you want to access the control inside that column here’s what you need to do:

  1. assuming you have a loop cycling through the rows
  2. Dim rw As UltraWebGrid.UltraGridRow = UltraWebGrid1.DisplayLayout.Rows(i)
  3. Dim cl As UltraWebGrid.UltraGridCell = rw.Cells.FromKey("myColumnName")
  4. Dim col As Infragistics.WebUI.UltraWebGrid.TemplatedColumn = cl.Column
  5. Dim ci As Infragistics.WebUI.UltraWebGrid.CellItem = col.CellItems(i)
  6. Dim chk As CheckBox = ci.FindControl("myCheckBoxID")

now you can access that checkbox and do whatever you want with it.

Upload file timeout

.Net, ASP No Comments »

if your webpage submits a file for uploading, and the page returns an error on larger file sizes, then look for 2 attributes to modify in your web.config .

open you web.config file and seach for the following line:

<httpRuntime executionTimeout="480" maxRequestLength="7168"/>

executionTimeout is the time limit before the request timesout and you get an error, this figure is represented in seconds (480 = 8 minutes)
maxRequestLength is the file size represented in KB (1024 = 1MB, 7168 – 7MB)

for detailed info, go to: http://msdn.microsoft.com/en-us/library/e1f13641(VS.71).aspx

Connection Strings

.Net, ASP No Comments »

Access File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Work\Tools\myaccessdb.mdb;”

SQL Server:
“user id=SqlLoginName;password=SqlPW;initial catalog=yourDBname;data source=YourServerName;Connect Timeout=30”

SQL – OLE DB:
 Data Source=ServerIP; User ID=SqlLoginName;password=SqlPW;initial catalog=yourDBname

CSV File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”c:\tool\myfile.csv”;Extended Properties=””text;HDR=No;FMT=Delimited”””

ODBC link:
 “DSN=myDB;UID=John;PWD=123;”

UPS shipment tracking in ASP.net

.Net, ASP No Comments »

great info on tracking UPS shipment from you ASP.net application

http://www.velocityreviews.com/forums/t72633-ups-tracking.html

Typed Datasets and Temp Tables

.Net, SQL No Comments »

The scenario: you have a stored procedure in SQL and a typed dataset in Visual Studio that references the stored procedure. In your stored procedure, you create a temporary table and fill it with data and use it as output. When you go to create the typed dataset, it does not recognize the columns that the stored procedure returns.

Solution: in Visual Studio, create you typed dataset and use the stored procedure as a source (even if it doesn’t recognize the columns). After it is done, right clck the xsd file in Solution Explorer and click “View Code”. You should get an xml representation of your dataset. Here is where you create your columns manually. You need to add the column definitions in 2 places:

  1. Find “TableAdapter”, under it look for “Mappings”, inside mappings you will add a node for each column like:
    <Mapping SourceColumn="CompanyName" DataSetColumn="CompanyName" />
  2. Find
    <xs:element name="dsGetCompany"…..
         <xs:element name="CompanyName" msprop:Generator_UserColumnName="CompanyName" ….

    you will add “<xs: element….” for each column you want to add. I found the best way is to copy these nodes from similar columns from another dataset.

For more information

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in