Author: husted
Date: Wed Sep 14 08:44:47 2005
New Revision: 280877

URL: http://svn.apache.org/viewcvs?rev=280877&view=rev
Log:
OVR-21
Modify to make better use of message resources.

Modified:
    struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs

Modified: struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs
URL: 
http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs?rev=280877&r1=280876&r2=280877&view=diff
==============================================================================
--- struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs 
(original)
+++ struts/sandbox/trunk/overdrive/PhoneBook/Web/Controls/Finder2.ascx.cs Wed 
Sep 14 08:44:47 2005
@@ -1,4 +1,5 @@
 using System;
+using System.Web.UI;
 using System.Web.UI.WebControls;
 using Nexus.Core.Helpers;
 using Nexus.Web.Controls;
@@ -8,19 +9,6 @@
 {
        public class Finder2 : ViewControl
        {
-               public Label last_name_label;
-               public Label first_name_label;
-               public Label extension_label;
-               public Label user_name_label;
-               public Label hired_label;
-               public Label hours_label;
-
-               protected DropDownList last_name_list;
-               protected DropDownList first_name_list;
-               protected DropDownList extension_list;
-               protected DropDownList user_name_list;
-               protected DropDownList hired_list;
-               protected DropDownList hours_list;
 
                protected Button find;
 
@@ -29,18 +17,6 @@
                /// </summary>
                public event EventHandler Click;
 
-               private Label[] FilterLabels()
-               {
-                       Label[] labels = {last_name_label, first_name_label, 
extension_label, user_name_label, hired_label, hours_label};
-                       return labels;
-               }
-
-               private DropDownList[] FilterList()
-               {
-                       DropDownList[] lists = {last_name_list, 
first_name_list, extension_list, user_name_list, hired_list, hours_list};
-                       return lists;
-               }
-
                private void find_Click(object sender, EventArgs e)
                {
                        if (Click == null) return;
@@ -54,12 +30,15 @@
                        // Reset filter controls
                        int exceptIndex = 0;
                        if (except != null) exceptIndex = except.SelectedIndex;
-                       foreach (DropDownList filter in FilterList())
+                       foreach (Control c in Controls)
                        {
-                               filter.SelectedIndex = 0;
+                               if (IsListControl(c))
+                               {
+                                       DropDownList x = (DropDownList) c;
+                                       x.SelectedIndex = 0;
+                               }
                        }
                        if (except != null) except.SelectedIndex = exceptIndex;
-                       // Tell everyone that we are starting over
                }
 
                private void Filter_Changed(object sender, EventArgs e)
@@ -86,22 +65,18 @@
                private void Page_Load(object sender, EventArgs e)
                {
                        find.Click += new EventHandler(find_Click);
-                       foreach (DropDownList filter in FilterList())
-                       {
-                               filter.SelectedIndexChanged += new 
EventHandler(Filter_Changed);
-                       }
-                       if (!IsPostBack)
+                       foreach (Control c in Controls)
                        {
-                               find.Text = GetMessage(find.ID);
-                               foreach (Label label in FilterLabels())
+                               if (IsListControl(c))
                                {
-                                       label.Text = GetMessage(label.ID);
-                               }
-                               foreach (DropDownList filter in FilterList())
-                               {
-                                       filter.AutoPostBack = true;
+                                       DropDownList x = (DropDownList) c;
+                                       x.SelectedIndexChanged += new 
EventHandler(Filter_Changed);;
+                                       x.AutoPostBack = true;
                                }
                        }
+
+                       if (IsPostBack) return;
+                       GetMessages();
                }
 
                #region Web Form Designer generated code



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to