<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Biggle&#039;s Blog &#187; ASP.NET</title>
	<atom:link href="http://www.biggle.de/blog/category/development/aspnet/feed" rel="self" type="application/rss+xml" />
	<link>http://www.biggle.de/blog</link>
	<description>Web- und Software Development</description>
	<lastBuildDate>Sat, 31 Jul 2010 14:59:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Neuerungen in Visual Studio 2010</title>
		<link>http://www.biggle.de/blog/neuerungen-in-visual-studio-2010</link>
		<comments>http://www.biggle.de/blog/neuerungen-in-visual-studio-2010#comments</comments>
		<pubDate>Fri, 12 Mar 2010 09:48:11 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET4.0]]></category>
		<category><![CDATA[Basta]]></category>
		<category><![CDATA[VisualStudio]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=4104</guid>
		<description><![CDATA[Ich hab kürzlich die BASTA Spring 2010 besucht (über 500 Teilnehmer). Es war wirklich eine sehr informative Veranstaltung über aktuelle Entwicklungen im .NET Bereich. Folgender Abriss soll die Neuerungen im .NET Framework 4.0, Entity Framework 2, VisualStudio 2010, WPF 4 und Silverlight 4, aufzeigen. Im folgenden Artikel möchte ich über einige Neuerungen in Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p>Ich hab kürzlich die BASTA Spring 2010 besucht (über 500 Teilnehmer). Es war wirklich eine sehr informative Veranstaltung über aktuelle Entwicklungen im .NET Bereich. Folgender Abriss soll die Neuerungen im .NET Framework 4.0, Entity Framework 2, VisualStudio 2010, WPF 4 und Silverlight 4, aufzeigen.</p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/bastalogo13.jpg"><img src="http://www.biggle.de/blog/wp-content/uploads/2010/03/bastalogo13.jpg" alt="" title="bastalogo1" width="500" height="77" class="alignnone size-full wp-image-4119" /></a></p>
<p>Im folgenden Artikel möchte ich über einige Neuerungen in Visual Studio 2010 schreiben</p>
<p>Zu Beginn eine  Übersicht, welche Komponenten in welcher Version enthalten sein werden:</p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/visualStudio2010versionen.png"><img class="alignnone size-full wp-image-4105" title="visualStudio2010versionen" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/visualStudio2010versionen.png" alt="" width="500" height="337" /></a></p>
<p><br class="spacer_" /></p>
<h2>WPF basierter Editor</h2>
<p>Der Editor in VisualStudio 2010 ist komplett in WPF umgesetzt.</p>
<p><br class="spacer_" /></p>
<h2>MultiMonitor Unterstützung</h2>
<p>Für alle Fenster wird der Multimonitorbetrieb unterstützt</p>
<p><br class="spacer_" /></p>
<h2>Stufenloser Zoom</h2>
<p>Mit STRG &#8211; Mausrad kann der Code vergrößert werden</p>
<p><br class="spacer_" /></p>
<h2>Navigation</h2>
<ul type="disc">
<li>Quick Search </li>
<li>Highlight References </li>
</ul>
<p><br class="spacer_" /></p>
<h2>UML Designer (UltimateVersion)</h2>
<ul type="disc">
<li>Die Ultimate Edition von      Visual Studio unterstützt die Modellierung mit UML (use-case-, class-,      sequence-, activity- und componentdiagramme) </li>
<li>Beinhaltet eine      Code-Generierung (T4-TextTemplate) für C# und Visual Basic </li>
<li>Beinhaltet eine Datenbank      Script-Generierung </li>
</ul>
<p>Quelle: <a href="http://www.olegsych.com/2010/01/uml-modeling-and-code-generation-in-visual-studio-2010/">http://www.olegsych.com/2010/01/uml-modeling-and-code-generation-in-visual-studio-2010/</a></p>
<p><br class="spacer_" /></p>
<h2>Debugging</h2>
<p>Mit den neuen Funktionen von VS2010 können Windows-, Web, .NETbasierende Anwendungen effizienter und komfortabel, sowohl in virtuellen als auch in echten 32- und 64Bit Umgebungen, getestet werden.</p>
<p><br class="spacer_" /></p>
<h3>Pin to Source</h3>
<p>Mit Pin2Source kann man aus dem KontextMenu heraus die entsprechende Variable oder Abschnitt im QuellText &#8220;anpinnen&#8221;:</p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source.png"><img class="alignnone size-full wp-image-4106" title="pin2source" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source.png" alt="" width="500" /></a></p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source2.png"><img class="alignnone size-full wp-image-4107" title="pin2source2" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source2.png" alt="" width="500" /></a></p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source3.png"><img class="alignnone size-full wp-image-4108" title="pin2source3" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/pin2source3.png" alt="" width="500" /></a></p>
<p><br class="spacer_" /></p>
<h2>Tracepoints, Breakpoints, Conditionals</h2>
<h3>TracePoints</h3>
<p>Im KontextMenü des Editors findet man den Punkt &#8220;Insert Tracepoint&#8221;. TracePoints sind eine Erweiterung der Breakpoints und erlauben es, das Erreichen einer Ausführungszeile mit einer Aktion zu verknüpfen.</p>
<p>Tracepoints kann man beispielsweise zur Ausgabe von Variablenwerten im Ausgabefenster nutzen und so Konstrukte wie Console.WriteLine und die TraceKlasse ablösen – ohne einen Eingriff in den Quelltext!</p>
<p>Angenommen in folgender Schleife ist man an einen Increment interessiert und möchte laufend dessen Wert ausgeben:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Man klickt hier mit der rechten Maustaste auf die zweite Zeile und wählt im Kontextmenü Breakpoint > Insert Tracepoint. Im folgenden Dialog kann man den Tracepoint konfigurieren und für diesen folgende Ausgabe definieren:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">i ist <span style="color: #009900;">&#123;</span>i<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Während der Debug-Sitzung wird im Ausgabefenster nun einhundert Mal der Wert von i gelistet.</p>
<p>Tracepoints können aber noch mehr.</p>
<ul type="disc">
<li>Tracepoints können zusätzlich      wie ein normaler Breakpoint verwendet werden, wenn die Option Continue      execution deaktiviert wird. </li>
<li>Die Ausgabe kann mittels      weiterer Platzhalter wie {$FUNC} um sinnvolle Informationen erweitert      werden. </li>
<li>Beim Erreichen eines      Tracepoints kann man ein VisualStudio Makro auslösen. </li>
</ul>
<p><br class="spacer_" /></p>
<h3>BreakPoints</h3>
<ul type="disc">
<li>Breakpoint labeln und Export      aller Breakpoints </li>
<li>Breakpoints können per Drag      &amp; Drop heraus gezogen werden </li>
<li>Breakpoint-Pakete können      verschickt werden </li>
<li>Breakpoints im Code      definieren, nicht commiten : ) </li>
<li>Breakpoint Gruppen </li>
<li>Tools/Options/Debugging/General      Enable Just my Code ausstellen </li>
<li>CTRL &#8211; B setzt Breakpoint auf      beliebige Funktion (use intellisense aus) werden im Tree angezeigt      (Breakpoints) </li>
</ul>
<p><br class="spacer_" /></p>
<p>Webcast:</p>
<ul type="disc">
<li>Breakpoint      exportieren <a href="http://channel9.msdn.com/posts/Dariusz/VS-2010-Quick-Hit-Exportable-Breakpoints/">[1]</a> </li>
</ul>
<p><br class="spacer_" /></p>
<h3>Conditionals</h3>
<ul type="disc">
<li>Rechtsklick auf Breakpoint </li>
<li>(condition) In C# definieren </li>
<li>When hit: kann makro      ausführen… oder nur print , Anwendung bleibt nicht stehen </li>
</ul>
<p><br class="spacer_" /></p>
<h3>IntelliTrace</h3>
<p>Mit IntelliTrace reproduzierbare Fehler finden (Ultimate) IntelliTrace sammelt Informationen, die helfen die Fehlersuche und -diagnose zu vereinfachen und verbessert so die Produktivität beim Debugging. Aus der IntelliTrace Daten kann die Test-Session auf einem Entwickler-Rechner wiederhergestellt und die Fehler somit reproduziert werden.</p>
<ul type="disc">
<li>Wie kann man Probleme      debuggen, die nur beim Kunden auftreten </li>
<li>DumpDebugging </li>
<li>Prozesse save as dump </li>
<li>Kann sich selbst dumpen </li>
<li>File kann debugged werden </li>
<li>Alle Threads inkl aller  Variablen sind dort enthalten </li>
<li>*.DMP in vs2010 öffnen zeigt Exceptions und den StackTrace </li>
<li>IntelliTrace hilft beim Debugging von nichtreproduzierbaren Fehlern beim Tester ohne VS </li>
<li>TraceDebuggerTools beinhaltet  IntellTrace </li>
<li>collectionPlan.xml </li>
<li>Das entsprechende File kann dann mit IntelliTrace überprüft werden </li>
<li>Beinhaltet einen ASP.NET Client Proxy für IntelliTrace der Informationen über http-Aufrufe vom      Client zum Webserver sammelt. </li>
</ul>
<p>IntelliTrace muss in den Optionen > IntelliTrace aktiviert und konfiguriert werden</p>
<p>(IntelliTrace unter 64bit nicht möglich (auf x86 stellen))</p>
<p><br class="spacer_" /></p>
<h3>Debugger Attributes</h3>
<p>Im Namensraum System.Diagnostics gibt es eine Reihe von Attributen, die angewandt auf eigene Klassen das Verhalten des Debuggers beeinflussen können. Die Attribute werden für Klassen, Methoden oder Eigenschaften definiert.</p>
<p>Mit DebuggerBrowsableAttribute legt man fest, ob und wie eine Eigenschaft oder ein Feld in den verschiedenen Debugger- Fenstern (Locals, Autos, ..) angezeigt wird. Über die Enumeration DebuggerBrowsableState kann man einen der folgenden Werte wählen:</p>
<ul type="disc">
<li>Never = keine Anzeige, </li>
<li>Collapsed = Anzeige, </li>
<li>RootHidden = Anzeige der      Unterelemente, beispielsweise eines Arrays. </li>
</ul>
<p><br class="spacer_" /></p>
<h3>DebuggerDisplay</h3>
<p>Wird auf Klassenebene deklariert und legt fest, welche Informationen aus der Klasse in den DebuggingFenstern angezeigt werden sollen.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>DebuggerDisplay<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Kunde -  {FirstName}  {LastName}&quot;</span><span style="color: #009900;">&#93;</span></pre></div></div>

<p><br class="spacer_" /></p>
<h3>DebuggerVisualizer</h3>
<p>Wenn man noch mehr Möglichkeiten sucht, um einen Datentyp zu visualisieren, verwendet man das Attribute DebuggerVisualizer. Damit ist beispielsweise möglich, bei einem Datentyp Image sich dieses in Visual Studio anzeigen zu lassen.</p>
<p><br class="spacer_" /></p>
<h3>Debuggingrechte in Visual Studio</h3>
<p>Mit den Attributen DebuggerHidden, DebuggerStepperBoundary, DebuggerNonUserCode und DebuggerStepTrough lässt es sich festlegen, ob und wie VS das Debuggen einer Klasse oder einer Methode erlaubt.</p>
<p><br class="spacer_" /></p>
<h3>Thread Debugging</h3>
<ul type="disc">
<li>Debugging von mehreren      Threads (muss aktiviert werden) </li>
<li>Icon Diagramm rot grün + aktivieren </li>
<li>Rechtsklick flag, flagt den      entsprechenden Thread </li>
<li>Freeze kann alle Threads      anhalten, ein gezielter kann wieder aktiviert werden </li>
</ul>
<p><br class="spacer_" /></p>
<h3>Edit and continue</h3>
<p>Hier handelt es sich um ein Feature, das es einem ermöglicht &#8211; wie schon lange in Visual Basic &#8211; im DebuggingModus Änderungen am Quelltext vorzunehmen und ohne Neuzukompilieren diese zu übernehmen.</p>
<p>Das Feature kann unter Optionen > Debugging > Edit and Continue aktiviert werden</p>
<p>(Edit &amp; Continue funktioniert nicht, wenn IntelliTrace aktiviert ist)</p>
<p><br class="spacer_" /></p>
<h2>Entity Framework 2</h2>
<ul type="disc">
<li>Model First Development      (Generate DataBase from Model) </li>
<li>Create the database from code      (no model needed) </li>
<li>Ermöglicht das Generieren der      Datenbank aus dem Modell -und- auch aus dem Code heraus. </li>
</ul>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/ef2.png"><img class="alignnone size-full wp-image-4109" title="ef2" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/ef2.png" alt="" width="452" height="239" /></a></p>
<p><br class="spacer_" /></p>
<h3>Automatic Pluralization</h3>
<p>Bietet eine Pluralisierung an. EF würde in dem Fall an jeder Entität ein &#8220;s&#8221; anzuhängen. &#8230;</p>
<p><br class="spacer_" /></p>
<h3>Foreign Keys in Models</h3>
<p>Man kann Fremdschlüssel im Model verwenden, dazu beim Erstellen Include foreign key columns in the model aktivieren.</p>
<p><a href="http://www.biggle.de/blog/wp-content/uploads/2010/03/ef2vsef1.png"><img class="alignnone size-full wp-image-4111" title="ef2vsef1" src="http://www.biggle.de/blog/wp-content/uploads/2010/03/ef2vsef1.png" alt="" width="250" height="353" /></a></p>
<h3>Lazy Loading</h3>
<p>Der EF-Assistenten erzeugt enumerierbare Eigenschaften für jeden ForeignKey, den er auf einer Tabelle findet. Ein &#8220;Include&#8221; erzeugt innerhalb einer EF-Abfrage einen Join und bindet somit die Daten der verknüpften Tabelle mit ein. Diese Technik wird Eager Loading genannt und sorgt dafür das immer alle Daten im Join sind.</p>
<p>Das ist natürlich meist das Gegenteil, was man erreichen will, denn man möchte Daten erst dann von der Datenbank laden, wenn man sie auch benötigt.</p>
<p>Im Unterschied zur Nutzung von Include direkt auf der Entitäten-Menge Orders (ctx.Orders.Include(&#8220;Customers&#8221;)) kann das Load nun gezielt auf einzelne Order-Entitäten bei Bedarf erfolgen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">using <span style="color: #009900;">&#40;</span>NorthwindEntities ctx <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NorthwindEntities<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span>Orders orders in ctx<span style="color: #339933;">.</span>Orders<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        orders<span style="color: #339933;">.</span>CustomersReference<span style="color: #339933;">.</span>Load<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        Console<span style="color: #339933;">.</span>WriteLine<span style="color: #009900;">&#40;</span>orders<span style="color: #339933;">.</span>Customers<span style="color: #339933;">.</span>ContactName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h3>Lazy Loading auf Feldebene</h3>
<p>Fast noch wichtiger als das Lazy Loading auf Mengen-Ebene ist die Steuerung des Ladeverhaltens einer einzelnen Entität. Nehmen wir an, wir benötigen nur zwei Spalten aus der Customer Tabelle, um eine ComboBox mit den Spalten CustomerID und CompanyName zu binden. Im folgenden Code nutzen wir zunächst die scheinbar einfache Methode:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">using <span style="color: #009900;">&#40;</span>NorthwindEntities ctx <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NorthwindEntities<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    BindingSource bs <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> BindingSource<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    bs<span style="color: #339933;">.</span>DataSource <span style="color: #339933;">=</span> ctx<span style="color: #339933;">.</span>Customers<span style="color: #339933;">;</span>
    cbCustomers<span style="color: #339933;">.</span>ValueMember <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CustomerID&quot;</span><span style="color: #339933;">;</span>
    cbCustomers<span style="color: #339933;">.</span>DisplayMember <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;CompanyName&quot;</span><span style="color: #339933;">;</span>
    cbCustomers<span style="color: #339933;">.</span>DataSource <span style="color: #339933;">=</span> bs<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Also auf den ersten Blick scheint alles gut. Aber wie sieht es denn hinter den Kulissen aus, Das geschickte SQL-Kommando:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">SELECT
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>CustomerID<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>CustomerID<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>CompanyName<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>CompanyName<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>ContactName<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>ContactName<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>ContactTitle<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>ContactTitle<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Address<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Address<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>City<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>City<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Region<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Region<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>PostalCode<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>PostalCode<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Country<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Country<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Phone<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Phone<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
 <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Fax<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Fax<span style="color: #009900;">&#93;</span>
 FROM <span style="color: #009900;">&#91;</span>dbo<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Customers<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<p>Wir fragen also die komplette Tabelle Customers ab, nur um 2 Spalten anzuzeigen bzw. zu nutzen?! Das widerspricht also jeglicher Vernunft. In EF kann man dies durch die Rückgabe anonymer Typen über LINQ lösen:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">using <span style="color: #009900;">&#40;</span>NorthwindEntities ctx <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> NorthwindEntities<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">var</span> customers <span style="color: #339933;">=</span> from c in ctx<span style="color: #339933;">.</span>Customers
                  select <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #009900;">&#123;</span> c<span style="color: #339933;">.</span>CustomerID<span style="color: #339933;">,</span> c<span style="color: #339933;">.</span>CompanyName <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
    cboCustomers<span style="color: #339933;">.</span>DataSource <span style="color: #339933;">=</span> customers<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Dieses SQL Kommando dagegen lässt sich dann schon sehen </p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">SELECT
<span style="color: #cc66cc;">1</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>C1<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>CustomerID<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>CustomerID<span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>CompanyName<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>CompanyName<span style="color: #009900;">&#93;</span>
FROM <span style="color: #009900;">&#91;</span>dbo<span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #009900;">&#91;</span>Customers<span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">AS</span> <span style="color: #009900;">&#91;</span>Extent1<span style="color: #009900;">&#93;</span></pre></td></tr></table></div>

<h3>More LINQ operator Support</h3>
<p>.Single(), SingleOrDefault(); &#8230;</p>
<p><br class="spacer_" /></p>
<h3>EF1 vs. EF 2</h3>
<p>Neuer Designer</p>
<ul type="disc">
<li>Unterstützung von      POCO </li>
<li>Unterstützung von .tt      Vorlagen </li>
<li>Unterstützung von      Pluralisierung und Singularisierung </li>
<li>Fremdschlüssel </li>
<li>Model First Unterstützung </li>
<li>Lazy Loading Unterstützung </li>
<li>Missing LINQ Operators </li>
<li>Generated SQL unlesbar </li>
<li>N-Tier schwer </li>
<li>Bessere Unterstützung von      Stored Procedures </li>
</ul>
<p><br class="spacer_" /></p>
<h2>Workflow Foundation 4.0</h2>
<ul type="disc">
<li>Komplette Neuimplementierung      der WF in Version 4.0 </li>
<li>Mit Flowchart modellieren </li>
<li>Keine State-Machine mehr </li>
<li>Custom Activities </li>
<li>Kombinieren von WCF und WF </li>
<li>Base Activity Library </li>
<li>BPEL </li>
<li>Utilities </li>
<li>Expressions </li>
<li>Error handling </li>
<li>WCF Messaging </li>
<li>DataBase </li>
<li>WF Primitives </li>
<li>PowerShell </li>
<li>Interop </li>
<li>Control Flow Activities </li>
<li>Flowcharts </li>
<li>Sequential </li>
<li>Rules </li>
<li>Webcasts: </li>
<li><a href="http://www.cloudcasts.net/Default.aspx?category=WCF%20WF%204.0">http://www.cloudcasts.net/Default.aspx?category=WCF%20WF%204.0</a> </li>
<li><a href="http://channel9.msdn.com/pdc2008/TL17/">http://channel9.msdn.com/pdc2008/TL17/</a> </li>
<li><a href="http://www.microsoft.com/germany/msdn/webcasts/library.aspx?id=1032437931">http://www.microsoft.com/germany/msdn/webcasts/library.aspx?id=1032437931</a> </li>
<li><a href="http://www.microsoft.com/germany/msdn/webcasts/library.aspx?id=1032437932">http://www.microsoft.com/germany/msdn/webcasts/library.aspx?id=1032437932</a> </li>
<li><a href="http://msdn.microsoft.com/de-de/wf-screencasts.aspx">http://msdn.microsoft.com/de-de/wf-screencasts.aspx</a> </li>
<li>First WorkFlow <a href="http://mschnlnine.vo.llnwd.net/d1/ch9/8/5/4/6/2/4/WF_SeqWF.wmv">http://mschnlnine.vo.llnwd.net/d1/ch9/8/5/4/6/2/4/WF_SeqWF.wmv</a> </li>
<li>Google Suche <a href="http://www.google.de/search?hl=en&amp;rlz=1B3GGGL_enDE354DE354&amp;q=workflow+foundation+4.0+filetype%3Awmv&amp;btnG=Search&amp;aq=f&amp;oq=">http://www.google.de/search?hl=en&amp;rlz=1B3GGGL_enDE354DE354&amp;q=workflow+foundation+4.0+filetype%3Awmv&amp;btnG=Search&amp;aq=f&amp;oq=</a> </li>
<li>Quellen: </li>
<li><a href="http://msdn.microsoft.com/en-us/netframework/aa663328.aspx">http://msdn.microsoft.com/en-us/netframework/aa663328.aspx</a> </li>
<li>Überblick <a href="http://msdn.microsoft.com/de-de/netframework/cc896557.aspx">http://msdn.microsoft.com/de-de/netframework/cc896557.aspx</a> </li>
<li>Beginners Guide <a href="http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-Sequential-Workflow/">http://channel9.msdn.com/shows/Endpoint/Endpoint-Screencasts-Creating-Your-First-Sequential-Workflow/</a> </li>
<li>WF Scenarios      Guidance: <a href="http://msdn.microsoft.com/de-de/library/ee373755%28en-us%29.aspx">http://msdn.microsoft.com/de-de/library/ee373755%28en-us%29.aspx</a></li>
</ul>
<p><br class="spacer_" /></p>
<h2>F#</h2>
<p>Nach dem Start von J# nun ein erneuter Versuch unter den Namen F# eine Funktionale Sprache die sie nur auf das wesentliche für Mathematiker beschränken soll.</p>
<p><br class="spacer_" /></p>
<h2>Add-Ons</h2>
<p>Für das Installieren eines Addon ist nur noch das Kopieren notwendig (nicht mehr über die Registry).</p>
<p><br class="spacer_" /></p>
<h2>Architektur Explorer</h2>
<p>Ist ein integriertes Tool, das es ermöglicht die bestehende Architektur in einem Projekt oder einer binären Datei zu einen Modell zu erzeugen.</p>
<p><br class="spacer_" /></p>
<h2>Tipps &amp; Tricks in VS2010</h2>
<ul type="disc">
<li>Call Hierarchy CTRL + K, T </li>
<li>IntelliSense Suggestion Mode      (vs. Completion Mode) CTRL + ALT + Space </li>
</ul>
<p><br class="spacer_" /></p>
<h2>Visual Studio 2010 Web Frameworks</h2>
<ul type="disc">
<li>ASP.NET WebForms 4 </li>
<li>Neue Vorlagen mit Masterpages      und Stylesheets </li>
<li>Neues Routingmodell </li>
<li>ASP.NET MVC 4 </li>
<li>Komplett neue      Herangehensweise an Webseiten </li>
<li>Neues Modell, parallel zum      WebForms Modell </li>
<li>Schwerpunkt: Testbarkeit </li>
<li>ASP.NET Ajax 4 </li>
<li>Windows Azure SDK &amp; Tools </li>
<li>Dynamic Data </li>
<li>.NET RIA Services </li>
</ul>
<p><br class="spacer_" /></p>
<p>Im nächsten Artikel schreibe ich über einige Neuerungen in WPF 4.0</p>
<p><br class="spacer_" /></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de">Mario Priebe</a>.</p><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>12. März 2010 -- <a href="http://www.biggle.de/blog/weitere-neuerungen-veraenderungen-im-net-framework-4-0" title="Weitere Neuerungen im .NET Framework 4.0">Weitere Neuerungen im .NET Framework 4.0</a></li><li>12. März 2010 -- <a href="http://www.biggle.de/blog/parallele-programmierung-mit-net-4-0" title="Parallele Programmierung mit .NET 4.0">Parallele Programmierung mit .NET 4.0</a></li><li>12. März 2010 -- <a href="http://www.biggle.de/blog/named-optional-arguments-covariance-contravariance-dynamic-und-com-interop" title="Named &#038; Optional Arguments, Co- &#038; Contravariance, Dynamic und COM Interop">Named &#038; Optional Arguments, Co- &#038; Contravariance, Dynamic und COM Interop</a></li><li>11. Februar 2010 -- <a href="http://www.biggle.de/blog/visual-studio-2010-die-unterschiede" title="Visual Studio 2010 &#8211; Die Unterschiede">Visual Studio 2010 &#8211; Die Unterschiede</a></li><li>25. Juli 2010 -- <a href="http://www.biggle.de/blog/dynamische-klasse-mit-dynamicobject-erstellen" title="Dynamische Klasse mit DynamicObject erstellen">Dynamische Klasse mit DynamicObject erstellen</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/neuerungen-in-visual-studio-2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://mschnlnine.vo.llnwd.net/d1/ch9/8/5/4/6/2/4/WF_SeqWF.wmv" length="19840473" type="video/x-ms-wmv" />
		</item>
		<item>
		<title>Das MaxLength ASP.NET TextBox Problem</title>
		<link>http://www.biggle.de/blog/das-maxlenght-aspnet-textbox-problem</link>
		<comments>http://www.biggle.de/blog/das-maxlenght-aspnet-textbox-problem#comments</comments>
		<pubDate>Tue, 17 Mar 2009 14:13:57 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[CodeSnippet]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=1906</guid>
		<description><![CDATA[Die TextBox unter ASP.NET beachtet leider nicht die MaxLength wenn man ihr die MultiRow-Eigenschaft mitgibt. Folgender Snippet...]]></description>
			<content:encoded><![CDATA[<p>Die TextBox unter ASP.NET beachtet leider nicht die MaxLength wenn man ihr die MultiRow-Eigenschaft mitgibt. Folgender Snippet behebt das Problem:</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#region HelperMethod MaxLength
</span><span style="color: #666666; font-style: italic;">/// &lt;summary&gt;</span>
<span style="color: #666666; font-style: italic;">/// Eine TextBox welche die MultiRow Eigenschaft besitzt, ignoriert die MaxLength (bug)</span>
<span style="color: #666666; font-style: italic;">/// Diese Methode (JavaScript) behebt das Problem.</span>
<span style="color: #666666; font-style: italic;">/// Quelle: http://www.codegod.de/WebAppCodeGod/aspnet-textbox-maxlength-in-multiline-mode-AID297.aspx</span>
<span style="color: #666666; font-style: italic;">/// &lt;/summary&gt;</span>
<span style="color: #000000; font-weight: bold;">const</span> int maxLengthTextBox <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
protected void MaxLength<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    String
    lengthFunction <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;function isMaxLength(txtBox){&quot;</span><span style="color: #339933;">;</span>
    lengthFunction <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot; if(txtBox) { &quot;</span><span style="color: #339933;">;</span>
    lengthFunction <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;   return (txtBox.value.length &lt;&quot;</span> <span style="color: #339933;">+</span> maxLengthTextBox <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;);&quot;</span><span style="color: #339933;">;</span>
    lengthFunction <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot; }&quot;</span><span style="color: #339933;">;</span>
    lengthFunction <span style="color: #339933;">+=</span> <span style="color: #0000ff;">&quot;}&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    txtBox1<span style="color: #339933;">.</span>Attributes<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;onkeypress&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;return isMaxLength(this);&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    txtBox2<span style="color: #339933;">.</span>Attributes<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;onkeypress&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;return isMaxLength(this);&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Page<span style="color: #339933;">.</span>ClientScript<span style="color: #339933;">.</span>RegisterClientScriptBlock<span style="color: #009900;">&#40;</span><span style="color: #990000;">GetType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;txtLength&quot;</span><span style="color: #339933;">,</span> lengthFunction<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">#endregion</span></pre></td></tr></table></div>

<p><br class="spacer_" /></p>
<p>Quellenangabe: <a title="aspnet-textbox-maxlength-in-multiline-mode" href="http://www.codegod.de/WebAppCodeGod/aspnet-textbox-maxlength-in-multiline-mode-AID297.aspx" target="_blank">codegod</a></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de">Mario Priebe</a>.</p><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>4. April 2010 -- <a href="http://www.biggle.de/blog/alle-bilder-eines-verzeichnisses-php-quicky" title="Alle Bilder eines Verzeichnisses &#8211; PHP Quicky">Alle Bilder eines Verzeichnisses &#8211; PHP Quicky</a></li><li>3. Januar 2010 -- <a href="http://www.biggle.de/blog/aktuelles-copyright-datum-im-footer" title="Aktuelles &#8220;Copyright&#8221; Datum im Footer">Aktuelles &#8220;Copyright&#8221; Datum im Footer</a></li><li>19. Dezember 2009 -- <a href="http://www.biggle.de/blog/datenbankverbindung-php-mysql" title="Datenbankverbindung PHP / MySQL">Datenbankverbindung PHP / MySQL</a></li><li>19. Februar 2009 -- <a href="http://www.biggle.de/blog/regex-sonderzeichen-entfernen-c-quicky" title="Regex Sonderzeichen entfernen &#8211; C# Quicky">Regex Sonderzeichen entfernen &#8211; C# Quicky</a></li><li>13. Januar 2009 -- <a href="http://www.biggle.de/blog/keydown-in-asp-net-csharp" title="KeyDown in ASP .NET &#8211; CSharp">KeyDown in ASP .NET &#8211; CSharp</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/das-maxlenght-aspnet-textbox-problem/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KeyDown in ASP .NET &#8211; CSharp</title>
		<link>http://www.biggle.de/blog/keydown-in-asp-net-csharp</link>
		<comments>http://www.biggle.de/blog/keydown-in-asp-net-csharp#comments</comments>
		<pubDate>Tue, 13 Jan 2009 08:27:15 +0000</pubDate>
		<dc:creator>Mario Priebe</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.biggle.de/blog/?p=1465</guid>
		<description><![CDATA[Ich hatte ja schon hier einmal beschrieben, wie man in C# via Entertaste  eine TextBox bestätigt und so den Wert speichert. Ich wollte dies nun in ASP.NET nutzen, musste jedoch feststellen, das es dort kein Eventhandler für KeyDown gibt...]]></description>
			<content:encoded><![CDATA[<p>Ich hatte ja schon <a title="mit-enter-bestatigen-quicky-csharp" href="../blog/mit-enter-bestatigen-quicky-csharp">hier einmal beschrieben</a>, wie man in C# via Entertaste  eine TextBox bestätigt und so den eingegebenen Wert weiterverarbeitet. <br />
Ich wollte dies nun in ASP.NET nutzen, musste jedoch feststellen, das es dort kein Eventhandler für KeyDown gibt.</p>
<p>Nach einer Suche im Netz, bin ich dann auf folgende <a title="kamp-hansen.dk" href="http://www.kamp-hansen.dk/" target="_blank">VB.NET Lösung</a> gestossen*, welche ich in C# umgeschrieben habe.</p>
<p><br class="spacer_" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#region EnterButton
</span>void EnterButton<span style="color: #009900;">&#40;</span>WebControl _textBox<span style="color: #339933;">,</span> Control _button<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    StringBuilder sb <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;SCRIPT language=<span style="color: #000099; font-weight: bold;">\&quot;</span>javascript<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;function fnTrapKD(btn){&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; if (document.all){&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;   if (event.keyCode == 13)&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;   { &quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;     event.returnValue=false;&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;     event.cancel = true;&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;     btn.click();&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;   } &quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; } &quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;}&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    sb<span style="color: #339933;">.</span>Append<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/SCRIPT&gt;&quot;</span> <span style="color: #339933;">+</span> Environment<span style="color: #339933;">.</span>NewLine<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    _textBox<span style="color: #339933;">.</span>Attributes<span style="color: #339933;">.</span>Add<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;onkeydown&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;fnTrapKD(document.all.&quot;</span> <span style="color: #339933;">+</span> _button<span style="color: #339933;">.</span>ClientID <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    Page<span style="color: #339933;">.</span>ClientScript<span style="color: #339933;">.</span>RegisterStartupScript<span style="color: #009900;">&#40;</span><span style="color: #990000;">GetType</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;ForceDefaultToScript&quot;</span><span style="color: #339933;">,</span> sb<span style="color: #339933;">.</span>ToString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">#endregion</span></pre></td></tr></table></div>

<p><br class="spacer_" /></p>
<p>Aufgerufen wird dann das ganze im Load und zwar so:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">EnterButton<span style="color: #009900;">&#40;</span>txtBoxAddField<span style="color: #339933;">,</span> btnSave_Method<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Viel Spass damit ; )</p>
<p><div class="note"><div class="noteimportant">* Um den Codeschnipsel in VB.NET beim Janus Kamp Hansen zu sehen, solltest du den IE benutzen und dann im Menu den Punkt <em>Default Button in ASP.NET</em> unter <em>Usefull in ASP.NET</em> w&auml;hlen</div></div></p>
<hr /><p style="float:right; font-size:0.9em;">Dieser Beitrag stammt von <a href="http://www.biggle.de">Mario Priebe</a>.</p><h2  class="related_post_title">Ähnliche Beiträge</h2><ul class="related_post"><li>22. Januar 2010 -- <a href="http://www.biggle.de/blog/praktische-muster-commands" title="Praktische Muster &#8211; Commands">Praktische Muster &#8211; Commands</a></li><li>17. Januar 2010 -- <a href="http://www.biggle.de/blog/attribute-mittels-reflektion-abfragen" title="Attribute mittels Reflektion abfragen">Attribute mittels Reflektion abfragen</a></li><li>4. Januar 2010 -- <a href="http://www.biggle.de/blog/webservices-auf-erreichbarkeit-pruefen" title="Webservices auf Erreichbarkeit prüfen">Webservices auf Erreichbarkeit prüfen</a></li><li>1. Januar 2010 -- <a href="http://www.biggle.de/blog/net-quicky-linq2ef-videorial" title=".Net Quicky &#8211; Linq2Ef Videorial">.Net Quicky &#8211; Linq2Ef Videorial</a></li><li>5. November 2009 -- <a href="http://www.biggle.de/blog/geschwindigkeitsvorteile-mit-vorkompilierten-linq-queries" title="Geschwindigkeitsvorteile mit vorkompilierten LINQ-Queries">Geschwindigkeitsvorteile mit vorkompilierten LINQ-Queries</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.biggle.de/blog/keydown-in-asp-net-csharp/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
