Asp Dot Net Notes for Web Masters RSS 2.0
# Tuesday, February 02, 2010
Accessing the columns of a Detail Table that belongs to a RadGrid can be difficult.

I wanted to make some columns ReadOnly because they are Data Key Names or Foreign Key Names. There may be another way to achieve this behaviour but I could not find it.

Below is the solution I came up with.

/// <summary>
/// Makes the ID rows readonly. Have to use because the cols are Generated automatically
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
protected void Websites_RadGrid_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
    //##DetailTableDataBind Info at:
    //http://www.telerik.com/help/aspnet-ajax/grdhierarchicaldatabindingusingdetailtabledatabind.html         

    //Get the required cols 
    var Col1 = e.DetailTableView.AutoGeneratedColumns.SingleOrDefault(ColName => ColName.IsBoundToFieldName("DomainID"));
    var Col2 = e.DetailTableView.AutoGeneratedColumns.SingleOrDefault(ColName => ColName.IsBoundToFieldName("WebSiteID"));
    //If the col exists them make it read only.
    if (Col1 != null)
    {
        (Col1 as Telerik.Web.UI.GridBoundColumn).ReadOnly = true;
    }
    if (Col2 != null)
    {
        (Col2 as Telerik.Web.UI.GridBoundColumn).ReadOnly = true;
    }
}

Tuesday, February 02, 2010 12:07:10 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Controls
# Monday, December 07, 2009

My Setup

Operating System: Vista
Web Server: Microsoft IIS7 - Internet Information Services. This is the standard web server in the windows family.
Internet Connection: Connected to internet through a router.

Static IP address

Configure your PC so that when it connects to your router it will have a static IP address. Without a static IP address you may have to re-configure every time.

Here is a guide to setup Static IP address on Vista: http://portforward.com/networking/static-vista.htm

Virtual PC and XP Images

Download and install Microsoft Virtual PC 2007.  At the time of writing the Microsoft Virtual PC download and information pages are at:  http://www.microsoft.com/windows/virtual-pc/

Download and install a Virtual PC Image.  E.g. IE6-XPSP3.exe contains a Windows XP SP3 with IE6 VHD file. At the time of writing the Internet Explorer Application Compatibility VPC Image download page is at:  http://www.microsoft.com/downloads/details.aspx?FamilyID=21eabb90-958f-4b64-b5f1-73d0a413c8ef&displaylang=en

There are Virtual PC Images for testing IE6,IE7,IE8

Virtual PC Networking

When you have installed your Virtual PC 2007 and your selected Virtual PC, you will need to setup networking. In the Virtual PC Console select the Virtual PC you want to run and click settings. Select Networking in the list on the left. You should see a list of connection options. Select the one that is the Networking Controller that your Host PC is using to connect to the router. E.G. in my case it is “NVIDIA nForce Networking Controller”. The other options I have are “Not Connected”, “Local only”, “Shared Networking (NAT)”. You do not want to select any of those.

At this point you should be able to browse the internet in the Virtual PC using Internet Explorer. You can test live websites from here.

Virtual PC hosts file

To see websites on you host PC'c webserver, you must set the host PC's IP address in the Virtual PC's hosts file for each website you want to test.  The hosts file may be in this location: C:\WINDOWS\system32\drivers\etc

If not then you can use the windows search function to find it. Make sure that you tell it to search hidden folders.

Once you have found the hosts file you should make a shortcut to it and save it on the desktop of your Virtual PC. Then you can just add lines to the hosts file by opening it in Notepad.

E.g. My PC's static IP address is 192.168.1.8 so the line to add to the hosts file to see the website called localhost is:

192.168.1.8    localhost

Hopefully, now when you browse localhost on the Virtual PC you will now see the localhost website on the Host PC. You can setup all you development websites in the VPC hosts file so that you can test all your websites.



Monday, December 07, 2009 5:08:42 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Virtual PC
# Saturday, November 28, 2009
In Sitefinity, when editing a page if you click properties you can enter extra page URLs.

Add a new URL something like "~/home.html" and click Save Changes.

Then Make all html pages run as though Asp.Net pages. Look here.

http://dotnetnotes.i-do-it.com/2009/11/28/MapHTMLPagesThrougthASPNETDllRunHtmlPagesWithAspnetisapidll.aspx


Then add this to the Global.Asax
 void Application_Error(object sender, EventArgs e) 
    {        
//Redirect missing Old html Pages to the default url of that page. Add Additional Urls to pages in sitefinity to redirect to those pages.
        Exception lastException = this.Server.GetLastError();
        if (lastException is HttpException)
        {
            HttpException httpException = (HttpException)lastException;
            if (httpException.GetHttpCode() == 404)
            {
                // get the name of the requested page - just the /thisPage.htm or /DIR/thisPage.asp etc
                string pageName = string.Concat("~", Request.Url.AbsolutePath.ToString());

                // create a new instance of CmsManager
                Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager();

                // let's get the page by passing one of it's additional url's
                Telerik.Cms.IPage myPage = cmsManager.GetPageByAdditionalUrl(pageName);

                // we can cast myPage as ICmsPage and redirect to the Default URL
                if (myPage != null)
                {
                    //If there isa default page then redirect to it.                    
                    this.Server.ClearError();                    
                    Response.Redirect(((Telerik.Cms.ICmsPage)myPage).DefaultUrl.Url);
                }
            }
        }
    }

Saturday, November 28, 2009 12:01:48 PM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Configuration
Here is the code needed to run HTML pages with asp.net. Add it to the Web.Config.

The code comes from this post:
http://forums.iis.net/p/1158398/1907100.aspx


<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="ASPX-HTML-Integrated" path="*.html" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" /> <add name="ASPX-HTML-2.0-Classic-32bit" path="*.html" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" /> </handlers> </system.webServer> <system.web> <compilation> <buildProviders> <add extension=".html" type="System.Web.Compilation.PageBuildProvider" /> </buildProviders> </compilation> <httpHandlers> <add path="*.html" type="System.Web.UI.PageHandlerFactory" verb="*" /> </httpHandlers> </system.web> </configuration>

Saturday, November 28, 2009 11:18:26 AM (GMT Standard Time, UTC+00:00)  #    Comments [0] - Trackback
Asp.Net Configuration
# Friday, August 14, 2009
Here is a list of good Affiliate Marketing Web Sites who are trust worthy:

MyHelpHub.com

One of the easiest affiliate networks to join and start using. They have a smaller number of products when compared to the larger networks but this makes it easier for you to get to grips with affiliate marketing and to understand the full range of products on offer. All the products are kind of related because they are all self help books/guides. This means that your web site visitors may very well be interested in more than one product form this network. Examples of the products on offer are: Self help guides like “how to beat parking tickets” and how to beat parking Tickets, speed cameras, Wheel clamp fines and more.
  • They have a 50% commission structure so if a product costs £15 you receive £7.50. That is not bad at all.
  • You can get your commissions as soon as they have been approved rather than waiting for your balance to reach a minimum payout level. They also have new trackable links so you can see how many clicks a link received.
  • Payments via Paypal.

Affiliate Window

A Newer Marketing company which is part of Digital Window Ltd. They have won numerous awards for their platform which continues to develop and gain more and more merchants. Seems like many merchants have moved from Trade Doubler to Affiliate Window.

Note:
Charges £5 to sign up but you will receive the £5 back with your first commission.


Features:
  • Customizable Data Feeds (Create-a-Feed tool)
  • Discount Codes
  • Banners and Links
  • Deep Link Builder
  • Easy Set up Online Product Comparison Website (Shop Window)
  • Content Widgets
  • Affiliate Service API - Get Account and Merchant Data via API
  • Product Serve API - Get Product Data via API

buy.at

A leader in its class with many great merchants.

Commission Junction

Good Affiliate Company. One negative point is that they will close your accunt if you do not make enough sales.

Trade Doubler

Great Affiliate Companywith many useful tools and over ten years in the business.

Google AdSense

The Affiliate program to use if you want to display adverts targeted to your website visitors. These are pay per click adverts in both text and image format. This is the easiest and quickest method of affiliate marketing because you do not need to create content. You just add some JavaScript to your page and adverts related to your existing content will be displayed. You can even block out adverts from your competitors if necessary.

Rackspace Cloud

A Great Host for Asp.Net Windows Websites and Linux based Websites. Has an affiliate program.

Cloud Computing & Cloud Hosting by Rackspace
Friday, August 14, 2009 5:25:32 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Affiliate Marketing
# Wednesday, August 05, 2009

I just found this site http://buysellads.com/ that holds a database of publishers that want to sell advertising space on their website(s).

It looks very cool for publishers as it allows you to see exactly who is advertising on your site and all the statistics related to your advertisement slots.

Here are some points for publishers:

  • You have access to stats: e.g. Impressions, clicks, click through percentage, estimated cost per click per month etc.
  • Advertisement slots are sold with a fixed 30-day rate.
  • You receive 75% of the cost per 30 days hire of the advertisement slot.
  • You set the price per advertisement slot.
  • You also have the ability to allow rotation of adverts or just show one advert in a particular ad slot.

Advertisers can select sites by filtering the list of available sites. Filters include Impressions, Price for 30 days, Traffic Rank, category and advertisement size. This allows them to easily find sites that fit their budget and other requirements.

This seems like a very good service for anybody who wants to sell direct to advertisers while not having to setup and maintain your own advertisement selling/tracking system.

The big difference to Google AdSense is the ability to set your own advertisement slot price and the ability to know who is buying space on your site.

Do you know of any other good companies like the one above?

Wednesday, August 05, 2009 12:26:48 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Affiliate Marketing
Ajax is very good for adding functions and effects to your web pages.

So next time you need to add a specific effect or solve a problem on your website, remember to think to yourself, ‘Can Ajax solve my problem?’ If so then somebody may very well have already written the code for you. Check out the free Ajax libraries on the web.

Here are some links to very cool Ajax JavaScript Libraries.
Wednesday, August 05, 2009 11:11:29 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Ajax
# Wednesday, July 01, 2009
Set “pageExtension” to nothing to tell SiteFInity to use Extension less URLs.

The line to change looks like this:
<cms defaultProvider="Sitefinity" pageExtension=".aspx" disabled="false" pageEditorUIMode="Overlay">
Change  it so that the pageExtension property is empty liek this: pageExtension=""

Note: The FormsAthentication and RoleManager modules are not available for extensionless request but you need them for the admin section of Sitefinity.

To enable FormsAthentication and RoleManager add the runAllManagedModulesForAllRequests property to the modules section of the Web.Config file.
E.G. <modules runAllManagedModulesForAllRequests="true">

Now you should have Extension less URLs in Sitefinity.

Wednesday, July 01, 2009 12:07:14 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Configuration
# Sunday, June 21, 2009
Add functions such as Indent, Outdent, Custom Styles Selector, Custom Links Selector, Font Name, Font Size, Font ForeColor, Font BackColor, ConvertToLower, ConvertToUpper  Apply Custom Class Drop Down, Superscript, Subscript, Insert Paragraph, Insert Horizontal Rule, Help, Style Builder, Xhtml Validator, TrackChangesDialog, FormatCodeBlock, TableWizard, InsertSymbol etc.

To see available tools open file: Sitefinity/Admin/ControlTemplates/EditorToolsFileAll.xml.

E.g.
  <tools name="DropdownToolbar" dockable="false">
    <tool name="ForeColor" />
    <tool name="BackColor" />
    <tool separator="true" />
    <tool name="FontName" />
    <tool name="FontSize" />
    <tool name="ApplyClass" />
    <tool name="InsertCustomLink" />
    <tool name="FormatBlock" />
    <tool name="FormatStripper" />
  </tools>

Copy the required lines to the file: Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml

Now save the file and and open Rad Editor to see the extra tools.

Sunday, June 21, 2009 8:27:10 AM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Controls
# Wednesday, June 03, 2009
When trying to add inline Java Script to a Generic Content control the script tags are HTML encoded / removed.
This is the default behaviour so we must enable script tags.

To do this you must edit the control template for Generic Content.

Open the following file in Visual Studio:
Sitefinity --> Admin --> ControlTemplates --> Generic_Content --> App_LocalResources --> ContentVersionView.aspx.resx

Add a new setting: ContentFilters = None

There are still some problems with this. E.g. If you use a noscript tag then the contents of that tag will still get HTML encoded.
Wednesday, June 03, 2009 4:25:05 PM (GMT Daylight Time, UTC+01:00)  #    Comments [0] - Trackback
Controls
Archive
<July 2010>
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
I do I.T. Ltd.
Sign In
Statistics
Total Posts: 22
This Year: 1
This Month: 0
This Week: 0
Comments: 1
All Content © 2010, I do I.T. Ltd.