Haluk.com

.NET...tunes...developer tools

Website features

General:

  • Master Pages - The master page contains the header, menubar, footer, and ContentPlaceHolder's for the head & body.
    • menubar - basic unordered list.
    • ContentPlaceHolder - depending on the Content page, can be a 1-or-3-column layout.
  • Error Handling - customErrors is modified in web.config to redirect to a proper error page. The error is also processed through Application_Error in Global.asax. You can also .Transfer to a different error page in Global.asax. That transfer takes precedence over customErrors.
  • App_Themes - Currently, themes are only used on the tunes page. The .skin file is used to style the DropDownList, ListBox, and the GridView. The .css file is used to pad each row [This could have also been done using CellPadding in the .skin file].
  • App_Code - contains shared code by the website, such as the DAL; custom eventArgs; extension methods; httphandlers; httpmodules; Global.asax;
  • App_GlobalResources - contains multiple .resx files [one per culture] with name/value strings;
  • App_Data - contains SQLite3 database file for simple data;
  • web.config - modifications made to: customErrors; urlMappings; codeSubDirectories; httpHandlers; httpModules; mailSettings;

Content Pages:

  • home.aspx: 1-column layout.
  • tech.aspx: 3-column layout; place to index site features, samples, tutorials, tips, notes, references...
  • tunes.aspx: 3-column layout;
    -Left column has DropDownList and ListBox which populate the GridView in the middle;
    -Right column contains two stand-alone user controls (bpm, currenttime).
    -This page also uses Cookies to track the last category selected.
    Variations of tunes.aspx:
    • tunes   - uses plain ASP.NET with ADO.NET
    • tunes1 - uses plain ASP.NET with a SqlDataSource configured programmatically
    • tunes2 - uses AJAX.NET UpdatePanel
    • tunes3 - uses Page.ClientScript out-of-band callbacks;
      Similar to plain ajax where you can only return a string and you must parse it to build an HTML control
      1. Page must implement ICallbackEventHandler
      2. In markup or Page_Load, set 'onchange' of DropDownList to call a javascript function, GetTypes()
      3. In Page_Load, create GetTypes() with:
                                    this.ClientScript.RegisterClientScriptBlock(this.GetType(),"Callback","function GetTypes() { " + GetTypeInvocation() + " } ",true);
                                
      4. In code behind create GetTypeInvocation()
                                    private string GetTypeInvocation(){
                                        return Page.ClientScript.GetCallbackEventReference(this, "document.getElementById('" + ddlCategories.ClientID + "').value", "DisplayTypes", "\"context\"",true);
                                    }
                                
      5. GetCallbackEventReference first calls RaiseCallbackEvent, passing in as the parameter the selected DropDownList category value, then once RaiseCallbackEvent is finished, it calls DisplayTypes, where the first param is the results of GetCallbackResult, and the second is context
      6. Implement Public Void RaiseCallbackEvent(string eventArgument) in which you can do server side stuff here, building an HTML control and rendering that control to a string variable.
      7. Public string GetCallbackResult() returns the string variable created in RaiseCallbackEvent
      8. Create DisplayTypes(retval, context) jscript function, where retval is what GetCallbackResult returns; set your element to the retval here.
    • tunes4 - uses AJAX.NET with PageMethods
  • tools.aspx - 3-column layout. Contains multiple instances of ToolList user control, one per category.
    //TODO: create the user controls programmatically.
  • contact.aspx - 3-column layout; has Contact user control.
  • about.aspx - 3-column layout; about me; right column has RandomQuote user control.
  • admin.aspx - 3-column layout; has buttons for programmatic web.config encryption;

User Controls:

  • all user controls can be minimized by clicking their headers.
  • bpm.ascx - uses javascript to count bpms.
  • contact.ascx - has Validation for the input fields; uses Smtp to send email. Once submit button is clicked, a modal div appears to disable editing.
  • currenttime.ascx - uses javascript to update the time; if you're using <%=lblSomething.ClientID %>, the javascript must be inline, it cannot be in a separate file.
  • notes.ascx - basic list for my notes on the technology.
  • quotes.ascx - grabs a random quote from the database[SQLite]; clicking the quote uses regular ajax to retrieve another random quote by the way of an HttpHandler[.ashx]
  • quotes2.ascx - grabs a random quote from the database[SQLite]; clicking the quote uses AJAX.NET and PageMethods to retrieve another random quote.
  • toollist.ascx - creates a CRUD-enabled ListView for a specific Tool category.[SQLite]

©2009 Haluk.com