 |
Displaying XML like IE in a webpage
Paul Hayman (472 views)
Displaying XML like IE in a webpage
This is everything you need to display XML in your webpage the same way IE displays it when you open an XML document in IE.
Html
Register the js and place a literal where you'd like the XML to appear.
#h#<script src="XMLControl.js" type="text/javas
|
 |
Set Input Focus on a Control Programatically Added to an ASP.Net Page
Paul Marshall (829 views)
Set Input Focus on a Control Programatically Added to an ASP.Net Page
This little problem had the potential to drive me nuts for hours, I was fortunate to stumble over a blog with 100s of comments re problems of this nature and how to solve it. Most of the discussion was about using JavaScript
|
 |
Dynamically adding a CSS link to the page in c#
Paul Hayman (1378 views)
Dynamically adding a CSS link to the page in c#
The following code adds a CSS link to the header node of a Html page.
#c#// register css
#c#HtmlHead head = (HtmlHead)Page.Header;
#c#HtmlLink link = new HtmlLink();
#c#link.Attributes.Add("href", Page.ResolveClientUrl("~/App_Themes/Defaul
|
 |
Preventing Caching of an ASP.net page in c#
Paul Hayman (618 views)
Preventing Caching of an ASP.net page in c#
The following code prevents a page being cached.
#c#public static void PreventCaching(HttpContext context)
#c#{
#c# context.Response.Cache.SetExpires(DateTime.Now.Subtract(new TimeSpan(24, 0, 0)));
#c# context.Response.Cache.SetCacheabil
|
 |
Getting the Virtual Path of a Request in c#
Paul Hayman (2022 views)
Getting the Virtual Path of a Request in c#
This simple bit of code will get you the '''Virtual Path''' of your current request.
#c#public static string GetVirtualPath(string url)
#c#{
#c# if (HttpContext.Current.Request.ApplicationPath == "/")
#c# {
#c# return "~" + url;
#
|
 |
Fixing Form Action on UrlRewrite (UrlRewriter)
Paul Hayman (935 views)
Fixing Form Action on UrlRewrite
IF you're rewriting URL's, you've probably come across the same problem I had.
When posting back on the page, the real URL is used.. this is a real pain if you're writing a page which uses the '''RawUrl''' to serve up relevant content.
I had a good look a
|
 |
Custom Validators using Client Side JavaScript
Paul Marshall (1908 views)
Custom Validators using Client Side JavaScript
In my latest project I am really enjoying using the Ajax Control Toolkit, particularly the ModalPopupExtender.
I've been using the popup panels to capture data, but I needed to validate the data that a user enters into certain fields. ASP.net's
|
 |
Creating your first ASP.NET AJAX 1.0 Application
Michael O'Brien (1537 views)
Creating your first ASP.NET AJAX 1.0 Application
Over the last year or so, AJAX has taken the web development world by storm. AJAX is short for Asynchronous JavaScript and XML and is an approach to building dynamic web applications that behave less like the static web pages we're used to and mo
|
 |
Display CreateUserWizard Error Messages using a ContentTempate
Paul Marshall (1831 views)
CreateUserWizard Error Messages using a ContentTempate
In our latest project we are implementing Membership, Roles and Profiles. I've used these before, but never really had the need to exploit all the features.
The business requirements of the system have meant that I have had to implement
|
 |
Error connecting to undo manager of source file xxxx.aspx.designer.cs
Greg Duffield (1003 views)
Error connecting to undo manager of source file
'''The Problem'''
If you are using the Web Application Project Template (with as the Add On or as part of SP1) you can get this error.
This error can simply appear at any time for no apparent reason. There have been several suggestions on the
|
 |
Returning a value from a PageMethod
Paul Hayman (2924 views)
Returning a value from a PageMethod using MS AJAX
'''NOTE: This is designed for v1.0.61025.0 of AJAXExtensionsToolbox.dll'''
If you've ever returned data from a web service using MS AJAX this technique will look familar.
Call the method from javascript by append PageMethods. to the front
|
 |
Getting the ProviderUserKey for the Current User
Paul Hayman (820 views)
Getting the ProviderUserKey for the Current User
The following gets the ProviderUserKey for the current user.
#c#(Guid)Membership.GetUser().ProviderUserKey
|
 |
Rendering a Control to a String
Paul Hayman (1438 views)
Rendering a Control to a String
This is a really handy little function for rendering a control to a string. Really handy if you want to pass back rendered HTML from a StaticPageMethod or WebService.
#c#private static string GetRenderedControl(Control control)
#c#{
#c# HtmlTextWriter wri
|
 |
ASP.NET Framework 1.1 Validation not working in IE7?
Paul Hayman (2362 views)
ASP.NET Framework 1.1 Validation not working in IE7?
I recently had a problem with an old '''Framework 1.1''' website where the form would not post back if the page contained validators (CustomValidators to be exact). It caused me to do a lot of googling and in the end some javascript debugging
|
 |
LoginStatus not logging users out?
Paul Hayman (2079 views)
LoginStatus not logging users out?
Have you noticed your '''LoginStatus''' control doesn't log the user out when you click '''Logout'''? Well, to fix this all you need to do is add an '''id''' attribute.
This works
#h#<asp:LoginStatus runat="server" id="loginstatus1" />
This doesn
|
 |
XMLHTTPRequest in Stored Procedure
Dave Howard (4275 views)
XMLHTTPRequest in Stored Procedure
I recently had a requirement to call a webservice from a stored procedure. I looked into doing this by writing a CLR assembly in SQL 2005.
There were a few articles online describing this but working in a large organisation I knew that getting the thing wor
|
 |
Using a .Net 2.0 anonymous delegate when generating a thumbnail
Paul Hayman (1015 views)
Using a .Net 2.0 anonymous delegate when generating a thumbnail
Rather than using a mehod which does nothing except return false. Use a .Net 2.0 anonymous delegate for the GetThumbnailImageAbort parameter.
#c#delegate() { return false; }
Example
#c#System.Drawing.Image thumbResult = t
|
 |
Json converters lacking in Microsoft AJAX RTM
Dave Howard (2285 views)
Json converters lacking in Microsoft AJAX RTM
Having spent some time developing a project using a CTP version of Microsoft Ajax ("ATLAS" back in the day) I finally came to migrate the project to the RTM version.
After uninstalling the CTP release, and installing the RTM release I wasn't sur
|
 |
Handy fake latin generator
Paul Hayman (1432 views)
Handy fake latin generator
4guysfromrolla have a handy "fake latin" generator. It allows you to specify the number of paragraphs to generate. Source available too, although old asp.
http://www.4guysfromrolla.com/demos/latin.asp?paras=2
|
 |
CAPTCHA Server Control
Barrington Haynes (983 views)
CAPTCHA Server Control
I have been searching Google for a way to quickly implement CAPTCHA on one of my web sites and came across this article at The Code Project.
http://www.codeproject.com/aspnet/CaptchaControl.asp
http://www.codeproject.com/aspnet/CaptchaControl/captcha-control.png
|
 |
"This row already belongs to another table" Error
Paul Marshall (34605 views)
"This row already belongs to another table" Error
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/View37EB5230-5B79-4D00-800C-52D7A46CFB15.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/View37EB5230-
|
 |
Google Applicance - googleoff / googleon Tags
Paul Hayman (9018 views)
Google Applicance - googleoff / googleon Tags
'''I came across these recently... thought I'd share''' ;)
The googleoff/googleon tags disable the indexing of a part of a web page. The result is that those pages do not appear in search results when users search for the tagged word or phrase. F
|
 |
Typed Masterpage reference
Dave Howard (5901 views)
Typed Masterpage reference
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/View674ECBC1-7CC3-486E-A580-E4B048E1E3D5.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/View674ECBC1-7CC3-486E-A580-E4B048E1E3
|
 |
Authenticated HTTPRequests (Using Credentials)
Dave Howard (15387 views)
Authenticated HTTPRequests (Using Credentials)
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewC5E6201A-DFC1-4091-8145-5A893504C0E4.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/ViewC5E6201A-DFC1-
|
 |
Lightweight Ajax
Dave Howard (5073 views)
Lightweight Ajax
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewC77497B2-2CD6-4FBC-968C-93AFF2F397EB.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/ViewC77497B2-2CD6-4FBC-968C-93AFF2F397EB.htm" bo
|
 |
Web service calls from javascript using ATLAS (part 3) - Complex properties
Dave Howard (3187 views)
Web service calls from javascript using ATLAS (part 3) - Complex properties
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/View7DA902AA-513E-48D2-AD02-0F1A1946A999.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.gee
|
 |
Web service calls from javascript using ATLAS (part 2) - Complex return types
Dave Howard (4638 views)
Web service calls from javascript using ATLAS (part 2) - Complex return types
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewF266ADEB-8F62-4E92-8036-1D2436C2DE3A.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.g
|
 |
Web service calls from javascript using ATLAS (part 1)
Dave Howard (3712 views)
Web service calls from javascript using ATLAS (part 1)
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/View91E6FCCB-DB0A-499C-A2CC-9854452D2086.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/View91E6FC
|
 |
Not using Google Analytics? You should be!
Paul Marshall (4956 views)
Not using Google Analytics? You should be
Over the past few days I have received a number of comments regarding a recent article I published about re-directing a Page by Appending an HTTP Header, and linking this with '''Google's Analytics''' '''PPC tracking''' for '''Affiliate''' click-throug
|
 |
Auto-complete using ATLAS
Dave Howard (5640 views)
Auto-complete using ATLAS
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/View7585D539-C094-4211-9FFC-32FABE4D09B5.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/View7585D539-C094-4211-9FFC-32FABE4D09B
|
 |
Creating a Tag Cloud in C#
Paul Hayman (22731 views)
Creating a Tag Cloud in C#
I wanted to add a TagCloud to GeekZilla. The first thing I did was look around the web for some examples (or free components). To my supprise none jumped out at me. So, I decided to write my own.
At first I found myself wondering how I would render different size w
|
 |
Custom Templated SiteMap Navigator Control
Paul Hayman (3535 views)
Custom Templated SiteMap Navigator Control
After discovering the power of the SiteMap, especially when linked to Authentication, it wasn't long before binding the TreeView to the map was not enough.
I needed to have total control over what was displayed to the user for each item, so I wrote
|
 |
Redirect a page using a Header
Paul Marshall (9467 views)
Redirect a page using a Header
Any keen surfer will be familiar with '''Affiliate Marketing''', its a huge industry with '''Google's Adwords''' driving "Pay Per Click" campaigns. '''Google''' provide the '''Adwords''' application and '''Google Analytics''' to track the effectiveness of marketi
|
 |
Sending mail using Localhost and .Net 2
Greg Duffield (1370 views)
Sending mail using Localhost and .Net 2
I came across an old favourite today when trying to send email using the SMTP service on Local host. The error was
SMTP 550 5.7.1 Unable to relay for xxxxxx
What you need to do is change the security settings on the SMTP Service to allow your to r
|
 |
Comparing ATLAS and Dojo (part 1)
Mark Page (7655 views)
Comparing ATLAS and Dojo (part 1)
This is a first article in a series comparing some of the functionality of ATLAS with another popular AJAX framework called Dojo. Both frameworks have some powerfull components and there is a high degree of overlap.
This first article is a straight comparisi
|
 |
Programmatically adding LINKs to HTML HEADER in Code Behind
Paul Hayman (2779 views)
Programmatically adding LINKs to HTML HEADER in Code Behind
In this example I am adding a link to the html header pointing to an rss feed.
#c#HtmlLink link = new HtmlLink();
#c#link.Attributes.Add("type", "application/rss+xml");
#c#link.Attributes.Add("rel", "alternate");
#c#link.Attribut
|
 |
SQL ViewState
Barrington Haynes (4955 views)
SQL ViewState
Whilst working on a recent project, I was having problems with the size of the view state being downloaded to the client.
Whilst surfing Google, I found the following article which has now solved my problems, http://weblogs.asp.net/adweigert/archive/2004/03/09/86628.aspx
The
|
 |
Return new identity from Strongly Typed Dataset DataTable.Insert method
Dave Howard (13374 views)
Return new identity from Strongly Typed Dataset DataTable.Insert method
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewF2737CEE-4FCE-4215-B8CA-74D77EF64A5F.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzil
|
 |
TraceListener creates huge log files
Lee Keable (2247 views)
TraceListener creates huge log files
If you've used the .Net trace listeners, you'll know that they just keep appending to the file specified in the App.Config file, this can lead to some massive log files Here's a simple TraceListener that logs to a new file for every day.
#c#using Syst
|
 |
Integrating Dojo Fisheye and SiteMapDataSource
Mark Page (8809 views)
Integrating Dojo Fisheye and SiteMapDataSource
Everybody seems to be getting excited over this AJAX thing. Even Microsoft are (at last... ok they started it with OWA) getting on the bandwagon with the Atlas libraries.
Of course just because Atlas exists doesn't mean you cannot use some other
|
 |
Extending web.sitemap
Mark Page (6403 views)
Extending web.sitemap
If you are using '''ASP.NET''' you are probably already familiar with the new sitemap components.
The '''sitemapdatasource''' and '''web.sitemap''' elements make it very easy to build and maintain rich site structures.
Using the '''Eval''' statement and recursing acr
|
 |
Extending Strongly Typed Datasets
Dave Howard (3164 views)
Extending Strongly Typed Datasets
Strongly Typed Datasets are a rather nice addition to VS2005 (they don't lend themselves well to acronyms however)
You still need to create a database and tables and realationships but using STDs saves a writing huge amount of code.
If this code were gene
|
 |
Serializing abstract classes to XML
Dave Howard (5927 views)
Serializing abstract classes to XML
Digg it: http://digg.com/programming/Serializing_abstract_classes_to_XML_in_c
It is often useful to have abstract classes with several derived types to allow use of strongly typed lists and the such.
For example you might have a DocumentFragment class w
|
 |
Parser Error Message: Ambiguous match found.
Greg Duffield (6880 views)
Parser Error Message: Ambiguous match found.
VS 2005 Only.
This can be an annoying error, but it is usually caused by one thing.
If you add an object to your html source such as
#h#<igtxt:WebDateTimeEdit id="dteStartdate" runat="server" ToolTip="The end Date to use for the report." Edit
|
 |
Strongly Typed DataSets and GridViews
Dave Howard (5679 views)
Strongly Typed DataSets and GridViews
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewF9581DAE-CCF8-49FF-844C-7498603E0005.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/ViewF9581DAE-CCF8-49FF-84
|
 |
Could not write to output file ... The directory name is invalid
Paul Hayman (5936 views)
Could not write to output file ... The directory name is invalid
Recently had a problem deploying an app to a fresh 2003 server. Basically, the application wouldn't start, instead we recieved an error stating that the compiler couldn't write to the '''"Temporary ASP.NET Files"''' folder because
|
 |
Intellisence not working in web.config?
Paul Hayman (1616 views)
Intellisence not working in web.config?
Visual Studio 2005 has an interesting "feature" where Intellisence will not pop up when you're editing a web.config file. Annoying eh? Well, I found that removing the '''namespace''' from the '''configuration''' tag kicks it all back into life.
Change
|
 |
Changing the password rules for Forms Authentication
Paul Hayman (1926 views)
Changing the password rules for Forms Authentication
An annoying feature of the forms authentication controls shipped with VS2005 is that it forces users to enter non-alphanumberic characters in their passwords by default.. e.g. password would have to be password
Fortunately, this option ca
|
 |
Stopping simultaneous logins (Forms Authentication)
Paul Hayman (2080 views)
Stopping simultaneous logins (Forms Authentication)
The following code (called from a page load) will bump off users who are logged in when someone else logs in with the same credentials.
#c#public bool ValidSession()
#c#{
#c#
#c# lock (Cache)
#c# {
#c#
#c# string requestU
|
 |
Enabling HttpGet and HttpPost for web services
Barrington Haynes (2627 views)
Enabling HttpGet and HttpPost for web services
If your web application needs to accept incoming webservice method requests based on the '''GET''' and '''POST''' protocols then add the following lines to your ''web.config'' file.
#h#<configuration>
#h# <system.web>
#h# <webServices>
#h
|
 |
EasyHTTP
Barrington Haynes (2697 views)
EasyHTTP
EasyHTTP is a simple class which exposes the HTTP functionality of .NET as a number of simpler methods.
#c#using System;
#c#using System.Data;
#c#using System.Configuration;
#c#using System.Web;
#c#using System.Web.Security;
#c#using System.Web.UI;
#c#using System.Web.UI.WebCo
|
 |
Updating Foreign keys in a GridView
Dave Howard (5102 views)
Updating Foreign keys in a GridView
#$#<a href="http://www.dotnetkicks.com/kick/?url=http://www.geekzilla.co.uk/ViewD7E7F40C-85F7-47D8-89DE-0FB5F7AFAAE5.htm"><img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://www.geekzilla.co.uk/ViewD7E7F40C-85F7-47D8-89DE
|
 |
Garmin and Google Maps
Dave Howard (8709 views)
Garmin and Google Maps
The bought a Garmin Forerunner recently which is a really cool piece of kit but the maps that come with it are very poor.
Google maps has an API that allows you to integrate these rich maps into your own web applications.
Garmin has the option to export your traini
|
 |
Missing VS2005 Templates
Barrington Haynes (2279 views)
Missing VS2005 Templates
If you are having problems with missing VS2005 templates, then the following command run from the VS2005 command prompt may resolve your problems.
devenv /installvstemplates
|
 |
Perform actions before a row is deleted from a GridView or a DetailsView
Paul Marshall (5147 views)
Perform actions before a row is deleted from a GridView or a DetailsView
I'm a big fan of '''caching''' objects on the web server, really saves loads of unneccessary trips to SQL Server and those precious resources.
In a recent project I built some administration screens to change the con
|
 |
Select a row in an asp:GridView without using a Select Command
Paul Marshall (77592 views)
Select a row in an asp:GridView without using a Select Command
ASP.Net's GridViews can be quite useful, but beware of binding them to huge datasets as this has an overhead on the ViewState.
Often you'll want to display a number of columns on each line and row space becomes an issue. What's
|
 |
Error in Line 3?
Paul Hayman (1576 views)
Error in line 3
Some websites report an error in line 3 when using the asp.net controls such as login. We recently tracked this error down on one of our sites to the use of custom HttpHandlers.
All requests to anything other than *.aspx were routing through our own handler..
Adding the fo
|