blog.easyciel.net author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

Extending Gridview for ASP.NET 2.0

Tuesday, 23 May 2006 10:34 by prabian

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   .NET Projects
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

A lire si vous utilisez javascript…

Tuesday, 23 May 2006 08:55 by prabian

5 javascripts vraiment utiles : http://developpeur.journaldunet.com/tutoriel/dht/060512-5-javascripts-vraiment-utiles.shtml

 Quelques fonctions sympas : http://blogs.wdevs.com/Sukumar/archive/2005/05/10/3335.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   Javascript | css
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Want state led images ?

Sunday, 21 May 2006 17:16 by prabian

It could be useful…so, I share it !!!

    

That’s all ;)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   .NET Projects
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Which collection type to use in .NET 2.0 ?

Thursday, 18 May 2006 17:15 by prabian

Generic Class Description Non-Generic Counterpart
BindingList<T> List that supports complex data-binding scenarios None
Collection<T> Provides the base class for a generic collection CollectionBase
Comparer<T> Compares two objects of the same generic type for sorting Comparer
Dictionary<K, V> A collection of key/value pairs Hashtable
IEnumerable<T> A collection that can be iterated using a for-each statement IEnumerable
KeyedCollection<T, U> A keyed collection KeyedCollection
LinkedList<T> A doubly linked list None
List<T> The base class for a list ArrayList
Queue<T> A FIFO collection of objects Queue
ReadOnlyCollection<T> The base class for a generic read-only collection ReadOnlyCollectionBase
SortedDictionary<K, V> A collection of key/value pairs sorted by key SortedList
Stack<T> A simple LIFO collection of objects Stack

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Categories:   .NET Projects
Actions:   E-mail | del.icio.us | Permalink | Comments (0) | Comment RSSRSS comment feed

Assembly visible under visual studio references

Tuesday, 16 May 2006 12:57 by prabian

By default, a assembly (you created) is not visible in the visual studio project’s references…even if it is in the GAC.

You can add directories to the registry to specifiy to VS where to search your assemblies :

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies]
@="C:\\MyAssembliesPath\\"

To use this code :

  • Change ‘MyAssemblies’ by your contextual name.
  • Change ‘MyAssembliesPath’ by your contuextual file system path.
  • Create a .reg file, insert the code
  • …and double click.

For information, if the assembly is in the GAC, you should have a copy placed (for example) in the ‘Program Files\MyAssemblies’ directory.
So, your setup project can create this copy and auto-reference it in the registry.

 

Be the first to rate this post

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

Validate XML with XSD

Monday, 15 May 2006 06:45 by prabian

To validate an XML file with an XSD file, use this !

public static XmlDocument ValidateAndLoadXmlDocument(string xmlFilePath, string xsdFilePath)
{

XmlDocument xmlDoc;

XmlReaderSettings xmlSettings = new XmlReaderSettings();
xmlSettings.Schemas.Add(null, xsdFilePath);
xmlSettings.ValidationType = ValidationType.Schema;

XmlReader xmlReader = XmlReader.Create(xmlFilePath, xmlSettings);
xmlDoc = new XmlDocument();
xmlDoc.Load(xmlReader);

return xmlDoc;

}

Use this for asynchronous validation :

xmlSettings.ValidationEventHandler += new ValidationEventHandler(YourValidationEventHandler);

 

Be the first to rate this post

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

Remove nodes from xml document

Friday, 12 May 2006 23:54 by prabian

If you need to remove nodes from an xml document, here is an example.
This sample clean duplicated nodes and only keeps the last one (according to the date field). 
 
Source.xml (the file to filter) 
 
<?xmlversion="1.0"encoding="utf-8" ?>
<Root>
    <Products>
      <Product>
        <Name>Product1</Name>
        <DataGroup>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-10 </Date>
          </Data>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-01-13</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-02-09</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-19</Date>
          </Data>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-03-09</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-02-22</Date>
          </Data>
        </DataGroup>
      </Product>
      <Product>
        <Name>Product2</Name>
        <DataGroup>
          <Data>
            <Name>NADF</Name>
            <Value>VADF</Value>
            <Date>2006-01-13</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-01-19</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-03-09</Date>
          </Data>
          <Data>
            <Name>NAON</Name>
            <Value>VAON</Value>
            <Date>2006-04-21</Date>
          </Data>
          <Data>
            <Name>NABC</Name>
            <Value>VABC</Value>
            <Date>2006-05-23</Date>
          </Data>
        </DataGroup>
      </Product>
    </Products>
</Root>
 
Destination.xml (the result after filtering)  
 
<?xmlversion="1.0"encoding="utf-8"?>
<Root>
 <Products>
    <Product>
      <Name>Product1</Name>
      <DataGroup>
        <Data>
          <Name>NABC</Name>
          <Value>VABC</Value>
          <Date>2006-02-09</Date>
        </Data>
        <Data>
          <Name>NADF</Name>
          <Value>VADF</Value>
          <Date>2006-03-09</Date>
        </Data>
        <Data>
          <Name>NAON</Name>
          <Value>VAON</Value>
          <Date>2006-02-22</Date>
        </Data>
      </DataGroup>
    </Product>
    <Product>
      <Name>Product2</Name>
      <DataGroup>
        <Data>
          <Name>NADF</Name>
          <Value>VADF</Value>
          <Date>2006-01-13</Date>
        </Data>
        <Data>
          <Name>NAON</Name>
          <Value>VAON</Value>
          <Date>2006-04-21</Date>
       </Data>
        <Data>
          <Name>NABC</Name>
          <Value>VABC</Value>
          <Date>2006-05-23</Date>
        </Data>
      </DataGroup>
    </Product>
 </Products>
</Root>
 
C# Source with .NET 2.0 
 
XmlDocument xmlSourceDoc = new XmlDocument();
xmlSourceDoc.Load("Source.xml");
XmlNodeList productList = xmlSourceDoc
    .SelectNodes(@"//Root/Products/Product" );
 
SortedDictionary<string, XmlNode> nodesToKeep 
= new