ソースを参照

* RadioButton.cs: added ValueAttribute property to store the button value when in list
* RadioButtonList.cs: fixed tab index when rendering.

svn path=/trunk/mcs/; revision=57605

Vladimir Krasnov 20 年 前
コミット
2beb1b975f

+ 6 - 0
mcs/class/System.Web/System.Web.UI.WebControls/ChangeLog

@@ -1,3 +1,9 @@
+2006-03-06  Vladimir Krasnov  <[email protected]>
+
+	* RadioButton.cs: added ValueAttribute property to store the button
+	value when in list
+	* RadioButtonList.cs: fixed tab index when rendering.
+
 2006-03-02  Chris Toshok  <[email protected]>
 
 	* WebControl.cs (SkinID): implement setter/getter, and have them

+ 12 - 3
mcs/class/System.Web/System.Web.UI.WebControls/RadioButton.cs

@@ -78,11 +78,20 @@ namespace System.Web.UI.WebControls {
 			}
 		}
 
-		internal override void InternalAddAttributesToRender (HtmlTextWriter w)
+		internal string ValueAttribute {
+			get {
+				return ViewState.GetString ("Value", String.Empty);
+			}
+			set {
+				ViewState["Value"] = value;
+			}
+		}
+
+		internal override void InternalAddAttributesToRender (HtmlTextWriter w) 
 		{
 			base.InternalAddAttributesToRender (w);
-			string val = Attributes ["Value"];
-			if (val == null || val == "")
+			string val = ValueAttribute;
+			if (val == null || val.Length == 0)
 				val = UniqueID;
 			w.AddAttribute (HtmlTextWriterAttribute.Value, val);
 		}

+ 10 - 2
mcs/class/System.Web/System.Web.UI.WebControls/RadioButtonList.cs

@@ -47,6 +47,7 @@ namespace System.Web.UI.WebControls {
 	public class RadioButtonList : ListControl, IRepeatInfoUser,
 		INamingContainer, IPostBackDataHandler {
 		bool need_raise;
+		short tabIndex = 0;
 
 		public RadioButtonList ()
 		{
@@ -252,9 +253,10 @@ namespace System.Web.UI.WebControls {
 			radio.GroupName = UniqueID;
 			radio.Page = Page;
 			radio.Checked = Items [repeatIndex].Selected;
-			radio.Attributes["Value"] = Items [repeatIndex].Value;
+			radio.ValueAttribute = Items [repeatIndex].Value;
 			radio.AutoPostBack = AutoPostBack;
 			radio.Enabled = Enabled;
+			radio.TabIndex = tabIndex;
 			radio.RenderControl (writer);
 		}
 #if NET_2_0
@@ -321,8 +323,14 @@ namespace System.Web.UI.WebControls {
 			repeat.RepeatColumns = RepeatColumns;
 			repeat.RepeatDirection = RepeatDirection;
 			repeat.RepeatLayout = RepeatLayout;
+
+			tabIndex = TabIndex;
+			TabIndex = 0;
+
 			repeat.RenderRepeater (writer, this, ControlStyle, this);
- 		}
+
+			TabIndex = tabIndex;
+		}
 	}
 
 }