Browse by Tags

Related Posts

  • How To: Return Embedded Resource Content As String

    Here is a utility method for returning any embedded resource content as a string: public static partial class Tools { public static string GetEmbeddedContent( string resourceName) { Stream resourceStream = Assembly .GetAssembly( typeof ( Tools )).GetManifestResourceStream(resourceName); StreamReader...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-07-2007, 12:00 AM
    Filed under: .net, c#, code
  • Formatting code in blog entries

    I just posted a blog, and spent too much time trying to get my code to format correctly. At that, it did not turn out well. So, I read [this blog] and found what appears to be an easier way to format code in a blog entry. It it works, the code below should be very easy to read: private void ButtonFillDataGrids_Click...
    Posted to Palermo4 (Weblog) by Palermo4 on 10-23-2004, 12:00 AM
    Filed under: c#, code, reference
  • 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
  • Revision: Case-Insensitive String Equality

    I made revisions to my method for comparing strings while ignoring case . This is in light of some good feedback I received. Here is the updated method: public static bool AreEqualIgnoreCase( string firstString, string secondString) { // if references match (or both are null), quickly return if (firstString...
    Posted to Palermo4 (Weblog) by Palermo4 on 07-19-2007, 12:00 AM
    Filed under: .net, c#, 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
Page 1 of 4 (33 items) 1 2 3 4 Next >
Page view counter