Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx	(revision 6084)
@@ -0,0 +1,35 @@
+﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OKBNamedDetailControl.ascx.cs" Inherits="WebControls.OKBNamedDetailControl" %>
+
+
+<asp:Panel ID="Panel1" runat="server">
+  Detail:<br />
+  <table style="border: thin solid #C0C0C0; width:100%;">
+    <tr style="height: 30px; width:100%">
+      <td style="height: 30px; width:150px">
+        <asp:Button ID="btnStore" runat="server" onclick="btnStore_Click" 
+          Text="Store" />
+      </td>
+      <td>
+        &nbsp;</td>
+    </tr>
+    <tr style="height: 30px; width:100%">
+      <td style="height: 30px; width:160px">
+        <asp:Label ID="lbName0" runat="server" Text="Name: "></asp:Label>
+      </td>
+      <td>
+        <asp:TextBox ID="tbName" runat="server" AutoPostBack="True" 
+          ontextchanged="tbName_TextChanged" Width="95%"></asp:TextBox>
+      </td>
+    </tr>
+    <tr  style="height: 30px; width:100%">
+      <td style="height: 30px; width:160px">
+        <asp:Label ID="lbDescription0" runat="server" Text="Description: "></asp:Label>
+      </td>
+      <td>
+        <asp:TextBox ID="tbDescription" runat="server" AutoPostBack="True" 
+          ontextchanged="tbDescription_TextChanged" Width="95%"></asp:TextBox>
+      </td>
+    </tr>
+  </table>
+</asp:Panel>
+
Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.cs
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.cs	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.cs	(revision 6084)
@@ -0,0 +1,134 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using WebControls.HLAdminService;
+
+namespace WebControls {
+  public partial class OKBNamedDetailControl : System.Web.UI.UserControl {
+
+    // delegate for the stored event
+    public delegate void OKBItemStoredDelegate(Object sender, EventArgs e);
+
+    //event for the store button
+    public event OKBItemStoredDelegate OKBItemStored;
+
+    //private namedOKBItem
+    private static NamedOKBItem namedOKBItem;
+
+    /*
+     * Page_load is always executed when the control will be refreshed
+     */
+    protected void Page_Load(object sender, EventArgs e) {
+      if (UCWidth == null) {
+        UCWidth = "100%";
+      }
+      if (UCHeight == null) {
+        UCHeight = "150";
+      }
+      this.Panel1.Width = new Unit(UCWidth);
+      this.Panel1.Height = new Unit(UCHeight);
+
+      if (IsPostBack) {
+        namedOKBItem = (NamedOKBItem)ViewState["namedOKBItem"]; 
+      }
+      this.setEnableState();
+        
+    }
+
+    /*
+     * setNamedOKBItem, set a new OKBItem to the Control
+     * the Item is stored in the viewstate of the control
+     */
+    public void setNamedOKBItem(NamedOKBItem okbItem) {
+      namedOKBItem = okbItem;
+      if (namedOKBItem != null) {
+        tbName.Text = namedOKBItem.Name;
+        tbDescription.Text = namedOKBItem.Description;
+        tbName.DataBind();
+        tbDescription.DataBind();
+      }
+      ViewState["namedOKBItem"] = namedOKBItem;
+      this.setEnableState();
+    }
+
+    /*
+     * getNamedOKBItem, to get the current stored OKBItem
+     */
+    public NamedOKBItem getNamedOKBItem() {
+      return namedOKBItem;
+    }
+
+    /*
+     * setEnableState, is to se the enabledstate of the store button
+     */
+    private void setEnableState() {
+      if (namedOKBItem == null) {
+        this.Visible = false;
+      } else {
+        this.Visible = true;
+      }
+    }
+
+    private bool isModified() {
+      if (namedOKBItem.Name == tbName.Text && namedOKBItem.Description == tbDescription.Text) {
+        return false;
+      } else {
+        return true;
+      }
+    }
+
+    /*
+     * DataBind is to bind data manually
+     */
+    public override void DataBind() {
+      base.DataBind();
+      tbName.DataBind();
+      tbDescription.DataBind();
+    }
+
+
+    /*
+     * btnStore_Click, is always executed, if the store button is clicked
+     */
+    protected void btnStore_Click(object sender, EventArgs e) {
+      if (namedOKBItem != null) {
+        namedOKBItem.Name = tbName.Text;
+        namedOKBItem.Description = tbDescription.Text;
+        ViewState["namedOKBItem"] = namedOKBItem;
+        base.DataBind();
+        this.setEnableState();
+        if (null != OKBItemStored) {
+          OKBItemStored(this, EventArgs.Empty); 
+        }
+      }
+    }
+
+
+    private string UCWidth;
+    private string UCHeight;
+
+    public string Width { get { return UCWidth; } set { UCWidth = value; } }
+    public string Height { get { return UCHeight; } set { UCHeight = value; } }
+
+
+
+    /*
+     * tbName_TextChanged, is to refresh the view State of the control
+     */
+    protected void tbName_TextChanged(object sender, EventArgs e) {
+      setEnableState();
+    }
+
+    /*
+     * tbDescription_TextChanged, is to refresh the view State of the control
+     */
+    protected void tbDescription_TextChanged(object sender, EventArgs e) {
+      setEnableState();
+    }
+
+
+  }
+}
Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.designer.cs
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.designer.cs	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedDetailControl.ascx.designer.cs	(revision 6084)
@@ -0,0 +1,69 @@
+﻿//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated. 
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace WebControls {
+    
+    
+    public partial class OKBNamedDetailControl {
+        
+        /// <summary>
+        /// Panel1 control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Panel Panel1;
+        
+        /// <summary>
+        /// btnStore control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Button btnStore;
+        
+        /// <summary>
+        /// lbName0 control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Label lbName0;
+        
+        /// <summary>
+        /// tbName control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.TextBox tbName;
+        
+        /// <summary>
+        /// lbDescription0 control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Label lbDescription0;
+        
+        /// <summary>
+        /// tbDescription control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.TextBox tbDescription;
+    }
+}
Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx	(revision 6084)
@@ -0,0 +1,25 @@
+﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OKBNamedItemList.ascx.cs" Inherits="WebControls.OKBNamedItemList" %>
+
+
+<asp:Panel ID="Panel1" runat="server" >
+  <table style="border: thin solid #C0C0C0; width: 100%; height: 100%">
+    <tr style="height: 30px; width: auto;" >
+      <td align="center"  valign="middle" style="height: auto; width: auto; ">
+        <asp:Button ID="btn_New" runat="server" Text="new" />
+        <asp:Button ID="btn_Ascending" runat="server" Text="ascending" 
+          onclick="btn_Ascending_Click" />
+        <asp:Button ID="tn_Descending" runat="server" Text="descending" 
+          onclick="tn_Descending_Click" />
+        <asp:Button ID="btn_Delete" runat="server" Text="delete" />
+      </td>
+    </tr>
+    <tr style="height: 100%; width: auto">
+      <td style="height: 100%; width: auto">
+        <asp:ListBox ID="lb_NamedOKBItems" runat="server" Width="100%" Height="100%" 
+          AutoPostBack="True" 
+          onselectedindexchanged="lb_NamedOKBItems_SelectedIndexChanged">
+        </asp:ListBox>
+      </td>
+    </tr>
+  </table>
+</asp:Panel>
Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.cs
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.cs	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.cs	(revision 6084)
@@ -0,0 +1,236 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using WebControls.HLAdminService;
+using Wintellect.PowerCollections;
+using System.Collections;
+
+namespace WebControls {
+  // Class that implement the IComparer interface
+  // this is taken to sort the list ascending
+  class CompAsc : IComparer {
+    // Implement the IComparable interface. 
+    public int Compare(object obj1, object obj2) {
+      ListItem a, b;
+      a = (ListItem)obj1;
+      b = (ListItem)obj2;
+      
+      return a.Text.CompareTo(b.Text);
+    }
+  }
+
+  // Class that implement the IComparer interface
+  // this is taken to sort the list descending
+  class CompDsc : IComparer {
+    public int Compare(object obj1, object obj2) {
+      ListItem a, b;
+      a = (ListItem)obj1;
+      b = (ListItem)obj2;
+      return b.Text.CompareTo(a.Text);
+    }
+  }
+
+  public partial class OKBNamedItemList : System.Web.UI.UserControl {
+
+    // delegate for the selectedIndexChanged
+    public delegate void OKBSelectedIndexChangedDelegate(Object sender, EventArgs e);
+
+    //event for the selected index changed
+    public event OKBSelectedIndexChangedDelegate OKBSelectedIndexChanged;
+
+    // global list of NAmedOKBItem the will show the items from this list
+    public static IList<NamedOKBItem> namedOKBItemList;
+    // enum to switch between the orderstate
+    public enum orderState { ascending, descending }
+    // orderstate variable
+    public static orderState ordered;
+    // List of the ItemList for the listcontrol
+    public static ArrayList ItemsList;
+
+    // selectedindex of the list
+    private  int selectedIndex;
+
+    // selectedvalue of the list
+    private string selectedValue;
+
+    /// <summary>
+    /// is always executed on page load
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    protected void Page_Load(object sender, EventArgs e) {
+      // if width or height not set, then set default width and height
+      if (UCWidth == null) {
+        UCWidth = "100%";
+      }
+      if (UCHeight == null) {
+        UCHeight = "100%";
+      }
+
+      // set the size of the whole control
+      this.Panel1.Width = new Unit(UCWidth);
+      this.Panel1.Height = new Unit(UCHeight);
+
+      // if the control is reload after any action
+      if (IsPostBack) {
+        // restore the data of the namedOKBITemList from viewstate
+        namedOKBItemList = (IList<NamedOKBItem>)ViewState["namedOKBItemList"];
+        // restore the data of the selected index from viewstate
+        this.selectedIndex = (int)ViewState["selectedIndex"];
+        // restore the data of the selected value from the viewstate
+        this.selectedValue = (string)ViewState["selectedValue"];
+        // restore the data of the selectedNamedOKBItem
+        this.SelectedNamedOKBItem = (NamedOKBItem)ViewState["selectedNamedOKBItem"];
+      } else {
+        // default orderstate
+        ordered = orderState.ascending;
+        // default selectedindex
+        this.selectedIndex = -1;
+        // default selected value
+        this.selectedValue = "";
+        // store the settings in the viewstate
+        ViewState["selectedIndex"] = this.selectedIndex;
+        ViewState["selectedValue"] = this.selectedValue;
+      }
+    }
+
+    /// <summary>
+    /// set the datalist for this control
+    /// it will take a List of NamedOKBItem
+    /// and the control do all other for you
+    /// </summary>
+    /// <param name="okbList">list of NamedOKBItem</param>
+    public void setNamedOKBItemList(IList<NamedOKBItem> okbList) {
+      namedOKBItemList = okbList;
+      // store it in the viewstate
+      ViewState["namedOKBItemList"] = namedOKBItemList;
+      // execute the fillItemList methode to fill the values and id's in the Listcontrol
+      fillItemList();
+    }
+
+    // get the List of NamedOKBItem
+    public IList<NamedOKBItem> getNamedOKBItemList() {
+      return namedOKBItemList;
+    }
+
+    /// <summary>
+    /// this methode take the List of NamedOKBItems and fill it in the Listcontrol
+    /// 
+    /// </summary>
+    public void fillItemList() {
+      // Comparer for the list
+      IComparer comp = null;
+      // allocate new ArrayList
+      ItemsList = new ArrayList();
+      // clear old Items from List Control
+      lb_NamedOKBItems.Items.Clear();
+      // choose between the orderstate
+      if (ordered == orderState.ascending) {
+        comp = new CompAsc();
+      } else {
+        comp = new CompDsc();
+      }
+      // fill the list
+      if (namedOKBItemList != null) {
+        foreach (NamedOKBItem noi in namedOKBItemList) {
+          ListItem lItem = new ListItem(noi.Name, noi.Id.ToString());
+          ItemsList.Add(lItem);
+        }
+        // sort with the right comparer
+        ItemsList.Sort(comp);
+      }
+      foreach (ListItem li in ItemsList) {
+        lb_NamedOKBItems.Items.Add(li);
+      }
+      // at last bind the data
+      lb_NamedOKBItems.DataBind();
+    }
+
+    /// <summary>
+    /// this is the methode that will called when the ascending button is clicked
+    /// here the selected item will be stored in the global varaible
+    /// after the sort the selecteditem will again marked as select
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    protected void btn_Ascending_Click(object sender, EventArgs e) {
+      ordered = orderState.ascending;
+      ListItem selectedItem = null;
+      if (namedOKBItemList != null) {
+        if (lb_NamedOKBItems.SelectedIndex != -1) {
+          selectedItem = lb_NamedOKBItems.SelectedItem;
+          
+        }
+        fillItemList();
+        if (selectedItem != null) {
+          int index = lb_NamedOKBItems.Items.IndexOf(selectedItem);
+          lb_NamedOKBItems.SelectedIndex = index;
+        }
+        
+      }
+    }
+
+
+    /// <summary>
+    /// this is the methode that will called when the descending button is clicked
+    /// here the selected item will be stored in the global varaible
+    /// after the sort the selecteditem will again marked as select
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    protected void tn_Descending_Click(object sender, EventArgs e) {
+      ordered = orderState.descending;
+      ListItem selectedItem = null;
+      if (namedOKBItemList != null) {
+        if (lb_NamedOKBItems.SelectedIndex != -1) {
+          selectedItem = lb_NamedOKBItems.SelectedItem;
+        }
+        fillItemList();
+        if (selectedItem != null) {
+          int index = lb_NamedOKBItems.Items.IndexOf(selectedItem);
+          lb_NamedOKBItems.SelectedIndex = index;
+        }
+      }
+      
+    }
+
+    /// <summary>
+    /// this methode is called when the index is changed
+    /// </summary>
+    /// <param name="sender"></param>
+    /// <param name="e"></param>
+    protected void lb_NamedOKBItems_SelectedIndexChanged(object sender, EventArgs e) {
+      if (lb_NamedOKBItems.SelectedIndex == -1) {
+        this.SelectedNamedOKBItem = null;
+        
+      } else {
+        long id;
+        long.TryParse(lb_NamedOKBItems.SelectedValue, out id);
+        this.SelectedNamedOKBItem = namedOKBItemList.Where(x => x.Id == id).FirstOrDefault();
+ 
+      }
+      ViewState["selectedNamedOKBItem"] = this.SelectedNamedOKBItem;
+      this.selectedIndex = lb_NamedOKBItems.SelectedIndex;
+      this.selectedValue = lb_NamedOKBItems.SelectedValue;
+      ViewState["selectedIndex"] = this.selectedIndex;
+      ViewState["selectedValue"] = this.selectedValue;
+      if (OKBSelectedIndexChanged != null) {
+        OKBSelectedIndexChanged(this, EventArgs.Empty); 
+      }
+      
+    }
+
+    public NamedOKBItem SelectedNamedOKBItem { get; private set; }
+
+    // prpoerties for the controlsize
+    private string UCWidth;
+    private string UCHeight;
+
+    public string Width { get { return UCWidth; } set { UCWidth = value; } }
+    public string Height { get { return UCHeight; } set { UCHeight = value; } }
+
+  }
+}
Index: /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.designer.cs
===================================================================
--- /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.designer.cs	(revision 6084)
+++ /branches/WebApplication/MVC2/HLWebOKBAdminPlugin/UserControls/OKBNamedItemList.ascx.designer.cs	(revision 6084)
@@ -0,0 +1,69 @@
+﻿//------------------------------------------------------------------------------
+// <auto-generated>
+//     This code was generated by a tool.
+//
+//     Changes to this file may cause incorrect behavior and will be lost if
+//     the code is regenerated. 
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace WebControls {
+    
+    
+    public partial class OKBNamedItemList {
+        
+        /// <summary>
+        /// Panel1 control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Panel Panel1;
+        
+        /// <summary>
+        /// btn_New control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Button btn_New;
+        
+        /// <summary>
+        /// btn_Ascending control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Button btn_Ascending;
+        
+        /// <summary>
+        /// tn_Descending control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Button tn_Descending;
+        
+        /// <summary>
+        /// btn_Delete control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.Button btn_Delete;
+        
+        /// <summary>
+        /// lb_NamedOKBItems control.
+        /// </summary>
+        /// <remarks>
+        /// Auto-generated field.
+        /// To modify move field declaration from designer file to code-behind file.
+        /// </remarks>
+        protected global::System.Web.UI.WebControls.ListBox lb_NamedOKBItems;
+    }
+}
