Browse by Tags

Related Posts

  • Getting the absolute path in ASP.NET (part 2)

    In a previous blog , I received many comments on various ways I could get the application root. I am thankful for such comments. What most of the commenters did not realize is that I need the resolution of the url in a custom http module, where Control.ResolveUrl is not practical to use. And since I...
    Posted to Palermo4 (Weblog) by Palermo4 on 06-18-2004, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • Revision: Get the Value of a Control Without an Instance of the Control

    On an earlier post, I provided code that would retrieve the value of a control from the HTTP post without the need for an instance of the control . With good feedback, I made some modifications as follows: public static string GetControlValueFromRequest( string controlId) { if (controlId == null ) throw...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-20-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • To Compile or Not Compile

    ASP.NET 2.0 allows developers to configure whether a page compiles or not. Consider the following page directive: <% @ Page Language ="C#" CompilationMode ="Never" %> Setting the CompilationMode attribute to Never will disallow code on the page. It will also prevent compilation to an assembly....
    Posted to Palermo4 (Weblog) by Palermo4 on 07-17-2007, 12:00 AM
    Filed under: .net, asp.net, code
  • How To: Create a Strongly-Typed Property For HttpContext.Items

    HttpContext.Items is one of my favorite properties in ASP.NET. If I want to communicate a value from the HTTP pipeline to a page and then to a user control, this is my method for doing so. Because the Items property is an implementation of IDictionary, the key/value pair is not strongly-typed. If I am...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-12-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • How To: "Upsert" Into AppSettings

    ASP.NET 2.0 allows developers to update or insert values into web.config programmatically. This allows senior ASP.NET developers to create an administration or support page to modify values into web.config sections - without tampering with the web.config file directly. If I have a value I would like...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-11-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • How To: Obtain Method Name Programmatically For Tracing

    I am not a fan of hard-coding method names in exception or trace messages. Here is a utility method to allow access to method name at runtime: public static void TraceContext( string messageFormat) { Trace .WriteLine( string .Format(messageFormat, new System.Diagnostics. StackFrame (1).GetMethod().Name...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-08-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • How To: Dynamically Load A Page For Processing

    I have often desired the ability to dynamically load a page for processing, much like we do for .asxc controls with LoadControl(pathToASCX). For example, I may want to create a custom HTTP handler or module to dynamically load a page - while allowing me to programmatically change key properties before...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-06-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • Getting the Friendly Control ID

    Here is a simple utility method that will take a string argument such as "ctl00$ContentPlaceHolder1$DropDownList1" and return "DropDownList1" public static string GetFriendlyControlId( string renderedControlId) { // PageIdSeparator is a property returning Page.IdSeparator int indexOfSeparator = renderedControlId...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-05-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
  • Accessing Server Controls From Client Script

    In our AJAX QuickBuild event yesterday, Simon Allardice demonstrated for everyone how to access the value of a server control from client-side script. Let me share with you his tip/trick. It is quite simple. Here is the markup of a content page - notice the script tag: <% @ Page Language ="C#" MasterPageFile...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-03-2007, 12:00 AM
    Filed under: .net, asp.net, ajax, code
  • How To: Get the Value of a Control Without an instance of the Control

    On my quest to write one blog a day in July, here is my first post regarding how to get the value of a control without the control instance. This can be very helpful for HTTP pipeline development or when the value of the control is needed very early in the page lifecycle. public static string GetControlValueFromRequest...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-01-2007, 12:00 AM
    Filed under: .net, asp.net, c#, code
Page 1 of 5 (43 items) 1 2 3 4 5 Next >