Categories: ASP.NET, Basics, Framework.NET Posted by AlexanderZeitler on 3/11/2005 7:29 AM | Comments (0)

Karl Seguin liefert in seinem MSDN-Artikel "On the Way to Mastering ASP.NET: Introducing Custom Entity Classes" wie man anstelle von DataSets mit eigenen Entitäten arbeitet und diese in Custom Collections verwendet.

Mir persönlich ist der Ansatz bereits seit langem an's Herz gewachsen - CodeFairway.NET ist z.B. so aufgebaut.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, FAQ Posted by AlexanderZeitler on 1/26/2005 5:49 PM | Comments (0)
Thom Robbins hat eine Liste von ASP.NET Best Practices in seinem Blog als Powerpoint-Slides veröffentlicht.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, Controls, FAQ Posted by AlexanderZeitler on 1/22/2005 5:39 PM | Comments (0)

Scott Mitchell zeigt in seinem Artikel "Creating Dynamic Data Entry User Interfaces", wie man Formulare zur Erfassung von Daten basierend auf Informationen über Datenbankfelder, die mit den Daten befüllt werden sollen, dynamisch erzeugt.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, Controls, FAQ Posted by AlexanderZeitler on 12/28/2004 9:56 AM | Comments (0)

Der heutige ASP.NET Daily Article befasst sich mit dem Datenaustausch zwischen ASP.NET Seiten und in ihnen befindlichen User Controls - ASP.NET Basics, die man gelesen und verinnerlicht haben sollte ;-)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, FAQ Posted by AlexanderZeitler on 12/13/2004 9:35 PM | Comments (0)

Ein weiteres Snippet aus der Kategorie "braucht jeder irgendwann": Eine Datei, die in einer Datenbank zum liegt, zum Download anbieten:

FileClass file = FileClass.GetByGuid(new Guid(GuidFromQueryString));
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=filename.txt");
Response.AddHeader("Content-Length", file.FileContent.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.OutputStream.Write(file.FileContent,0,file.FileContentSize);
Response.End();

wobei FileClass wie folgt aussieht:

public class FileClass
{
    private Guid guid;
    private byte[] fileContent;
    private int fileContentSize;

    public Guid Guid {
        get { return guid; }
        set { guid = value; }
    }

    public byte[] FileContent {
        get { return fileContent; }
        set { fileContent = value; }
    }

    public int FileContentSize {
        get { return fileContentSize; }
        set { fileContentSize = value; }
    }

    public static FileClass GetByGuid(Guid Guid) {
        // wandelt das DataSet in ein Objekt vom Typ FileClass und gibt es zurück
        return DataSetToObject(DALFiles.GetByGUID(Guid));
    }
}

Wie man aus dem String in der Datenbank ein byte[] erhält, steht im vorangegangenen Posting...

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, Controls, DataGrid, FAQ Posted by AlexanderZeitler on 12/10/2004 7:11 AM | Comments (0)

Um das ItemCommand des DataGrids durch ein User Control, das im DataGrid liegt, auszulösen, ist das sog. Event Bubbling notwendig. Wie das funktioniert zeigt der Artikel "How to add a control to the datagrid that bubbles events.." von Richard Cockerham.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics Posted by AlexanderZeitler on 11/29/2004 8:46 PM | Comments (0)

Rene Drescher-Hackel hat mir basierend auf meinem Posting "HTML Controls in ASP.NET abbilden" eine interessante Lösung zum Befüllen einer HTML-DropDownList (Select) mit Farbwerten und entsprechender Colorierung der jeweiligen Zeile gemailt.

Hier der Code:

default.aspx:

<%@ Page language="c#" Codebehind="default.aspx.cs" AutoEventWireup="false" Inherits="BlogSamples.ColoredDropDownList._default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>default</title>

<meta name="vs_defaultClientScript" content="JavaScript" />
<meta name="vs_targetSchema" content="http://www.w3.org/1999/xhtml" />

</head>

<body>

<form id="default" method="post" runat="server">
<select id="AllgemeinBackColor" runat="server" name="AllgemeinBackColor"></select>
</form>

</body>
</html>

default.aspx.cs:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace BlogSamples.ColoredDropDownList
{
    /// <summary>
    /// Zusammenfassung für _default.
    /// /// </summary>
    public class _default : System.Web.UI.Page
    {
        protected System.Web.UI.HtmlControls.HtmlSelect AllgemeinBackColor;

        private void Page_Load(object sender, System.EventArgs e)
        {
            SetColors(AllgemeinBackColor);
        }

        private void SetColors(HtmlSelect obj) {
            Type t = typeof(Color);
            System.Reflection.PropertyInfo[] colors =
                t.GetProperties();
            for(int i = 0; i < colors.Length; i++) {
                if(colors[i].GetGetMethod().ReturnType
                    == typeof(Color)) {
                    obj.Items.Add(colors[i].Name);
    
                    obj.Items[i].Attributes.Add("style","BACKGROUND-COLOR: " +
                        colors[i].Name.ToString() +"");
                    obj.DataBind();
                }
            }
        }


        #region Vom Web Form-Designer generierter Code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: Dieser Aufruf ist für den ASP.NET Web Form-Designer erforderlich.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary>
        /// Erforderliche Methode für die Designerunterstützung.
        /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
        }
        #endregion
    }
}

So funktioniert Community ;-)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, FAQ Posted by AlexanderZeitler on 11/23/2004 6:41 AM | Comments (0)

Da das Verständnis des ASP.NET Page bzw. Control Life Cycles für die Arbeit mit (dynamisch erzeugten) UserControls unabdingbar ist, anbei einige Links zu dem Thema:

The ASP.NET Page Object Model - One Day in the Life of an ASP.NET Web Page

Control Execution Lifecycle

Page Events: Order and PostBack

ASP.NET Life Cycle and Best Practices

Liste der Events einer ASP.NET Seite chronologisch

event models

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: ASP.NET, Basics, FAQ Posted by AlexanderZeitler on 10/6/2004 7:06 AM | Comments (0)

In meinem Beitrag Einträge ins EventLog speichern hatte ich eine einfache Möglichkeit vorgestellt, um Statusmeldungen aus eigenen Applikationen in das Eventlog des Rechners speichern zu können.

Damit dieser Ansatz auch mit ASP.NET funktioniert, muss der ASPNET-User bzw. der User des ApplicationPools, in dem die ASP.NET Applikation läuft, auf den Registry-Schlüssel

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog

folgende Rechte erhalten:

  • Wert abfragen
  • Wert festlegen
  • Unterschlüssel erstellen
  • Unterschlüssel auflisten
  • Benachrichtigen
  • Lesen

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories: Artikel.NET, Basics, DataGrid Posted by AlexanderZeitler on 9/28/2004 4:44 PM | Comments (0)

Nach der eigentlich nicht vorhandenen Sommerpause habe ich mich einmal mehr am ASP.NET DataGrid vergriffen. Das Ergebnis ist mein neuer Artikel "DataGrid - Daten bearbeiten leicht gemacht" bei ASPHeute, der für jeden interessant sein dürfte, der Daten im DataGrid bearbeiten, löschen oder sortieren will.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5