[AspNetHostingPermissionAttribute (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
// attributes
[ValidationProperty ("SelectedItem")]
-#if NET_2_0
[SupportsEventValidation]
-#endif
- public class RadioButtonList : ListControl, IRepeatInfoUser,
- INamingContainer, IPostBackDataHandler {
-#if !NET_2_0
- bool need_raise;
-#endif
+ public class RadioButtonList : ListControl, IRepeatInfoUser, INamingContainer, IPostBackDataHandler
+ {
short tabIndex = 0;
public RadioButtonList ()
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (-1)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (-1)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (0)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (RepeatDirection.Vertical)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (RepeatLayout.Table)]
[WebSysDescription ("")]
[WebCategory ("Layout")]
}
set {
- if (value != RepeatLayout.Flow && value != RepeatLayout.Table)
+ bool outOfRange;
+ outOfRange = value < RepeatLayout.Table || value > RepeatLayout.OrderedList;
+ if (outOfRange)
throw new ArgumentOutOfRangeException ("The radio buttons layout is not one of the RepeatLayout values.");
ViewState ["RepeatLayout"] = value;
}
}
-#if ONLY_1_1
- [Bindable (true)]
-#endif
[DefaultValue (TextAlign.Right)]
[WebSysDescription ("")]
[WebCategory ("Appearance")]
// Interface properties
-#if NET_2_0
- [MonoTODO]
- protected virtual bool HasFooter
- {
- get {
- throw new NotImplementedException ();
- }
+ protected virtual bool HasFooter {
+ get { return false; }
}
- [MonoTODO]
- protected virtual bool HasHeader
- {
- get {
- throw new NotImplementedException ();
- }
+ protected virtual bool HasHeader {
+ get { return false; }
}
- [MonoTODO]
- protected virtual bool HasSeparators
- {
- get {
- throw new NotImplementedException ();
- }
+ protected virtual bool HasSeparators {
+ get { return false; }
}
-
- [MonoTODO]
- protected virtual int RepeatedItemCount
- {
- get {
- throw new NotImplementedException ();
- }
+
+ protected virtual int RepeatedItemCount {
+ get { return Items.Count; }
}
-#endif
bool IRepeatInfoUser.HasFooter {
- get { return false; }
+ get { return HasFooter; }
}
bool IRepeatInfoUser.HasHeader {
- get { return false; }
+ get { return HasHeader; }
}
bool IRepeatInfoUser.HasSeparators {
- get { return false; }
+ get { return HasSeparators; }
}
int IRepeatInfoUser.RepeatedItemCount {
- get { return Items.Count; }
+ get { return RepeatedItemCount; }
}
protected override Style CreateControlStyle ()
return new TableStyle (ViewState);
}
-#if NET_2_0
- [MonoTODO]
+ // MSDN: Searches the current naming container for a server control
+ // with the specified ID and path offset. The FindControl method
+ // always returns the RadioButtonList object.
protected override Control FindControl (string id, int pathOffset)
{
- throw new NotImplementedException ();
+ return this;
}
-#endif
-#if NET_2_0
- protected virtual
-#endif
- Style GetItemStyle (ListItemType itemType, int repeatIndex)
+ protected virtual Style GetItemStyle (ListItemType itemType, int repeatIndex)
{
return null;
}
-#if NET_2_0
- protected virtual
-#endif
- void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
+ protected virtual void RenderItem (ListItemType itemType, int repeatIndex, RepeatInfo repeatInfo, HtmlTextWriter writer)
{
+ ListItem item = Items [repeatIndex];
+
RadioButton radio = new RadioButton ();
- radio.Text = Items [repeatIndex].Text;
+ radio.Text = item.Text;
radio.ID = ClientID + "_" + repeatIndex;
radio.TextAlign = TextAlign;
radio.GroupName = UniqueID;
radio.Page = Page;
- radio.Checked = Items [repeatIndex].Selected;
- radio.ValueAttribute = Items [repeatIndex].Value;
+ radio.Checked = item.Selected;
+ radio.ValueAttribute = item.Value;
radio.AutoPostBack = AutoPostBack;
- radio.Enabled = Enabled;
+ radio.Enabled = IsEnabled;
radio.TabIndex = tabIndex;
-#if NET_2_0
radio.ValidationGroup = ValidationGroup;
radio.CausesValidation = CausesValidation;
-#endif
+ if (radio.HasAttributes)
+ radio.Attributes.Clear ();
+ if (item.HasAttributes)
+ radio.Attributes.CopyFrom (item.Attributes);
+
radio.RenderControl (writer);
}
-#if NET_2_0
- protected virtual
-#endif
- bool LoadPostData (string postDataKey, NameValueCollection postCollection)
+
+ protected virtual bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
+ EnsureDataBound ();
string val = postCollection [postDataKey];
ListItemCollection items = Items;
int end = items.Count;
if (i != selected) {
SelectedIndex = i;
-#if NET_2_0
return true;
-#else
- need_raise = true;
-#endif
}
-#if !NET_2_0
- return true;
-#endif
}
return false;
}
-#if NET_2_0
- protected virtual
-#endif
- void RaisePostDataChangedEvent ()
+ protected virtual void RaisePostDataChangedEvent ()
{
-#if NET_2_0
- if (CausesValidation)
- Page.Validate (ValidationGroup);
-#endif
-
-#if !NET_2_0
- if (need_raise)
-#endif
- OnSelectedIndexChanged (EventArgs.Empty);
+ ValidateEvent (UniqueID, String.Empty);
+ Page page = Page;
+ if (CausesValidation && page != null)
+ page.Validate (ValidationGroup);
+
+ OnSelectedIndexChanged (EventArgs.Empty);
}
bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
RenderItem (itemType, repeatIndex, repeatInfo, writer);
}
-#if NET_2_0
- protected internal
-#else
- protected
-#endif
- override void Render (HtmlTextWriter writer)
+ protected internal override void Render (HtmlTextWriter writer)
{
+ Page page = Page;
+ if (page != null)
+ page.ClientScript.RegisterForEventValidation (UniqueID);
+
+ if (Items.Count == 0)
+ return;
+
RepeatInfo repeat = new RepeatInfo ();
repeat.RepeatColumns = RepeatColumns;
repeat.RepeatDirection = RepeatDirection;
}
+
+
+
+