get {
string unique = UniqueID;
string gn = GroupName;
+ if (gn.Length == 0)
+ return unique;
int colon = -1;
- if (unique != null)
- colon = unique.IndexOf (':');
+ if (unique != null) {
+#if NET_2_0
+ colon = unique.LastIndexOf (IdSeparator);
+#else
+ colon = unique.IndexOf (IdSeparator);
+#endif
+ }
+
if (colon == -1)
return gn;
-
+
return unique.Substring (0, colon + 1) + gn;
}
}
internal string ValueAttribute {
get {
- return ViewState.GetString ("Value", String.Empty);
+ string val = (string)ViewState ["Value"];
+ if (val != null)
+ return val;
+
+#if NET_2_0
+ string id = ID;
+ if (!String.IsNullOrEmpty (id))
+ return id;
+ else
+#endif
+ return UniqueID;
}
set {
ViewState["Value"] = value;
internal override void InternalAddAttributesToRender (HtmlTextWriter w)
{
+#if NET_2_0
+ Page page = Page;
+ if (page != null)
+ page.ClientScript.RegisterForEventValidation (NameAttribute, ValueAttribute);
+#endif
base.InternalAddAttributesToRender (w);
- string val = ValueAttribute;
- if (val == null || val.Length == 0)
- val = UniqueID;
- w.AddAttribute (HtmlTextWriterAttribute.Value, val);
+ w.AddAttribute (HtmlTextWriterAttribute.Value, ValueAttribute);
}
#if NET_2_0
#endif
bool LoadPostData (string postDataKey, NameValueCollection postCollection)
{
- bool old_checked = Checked;
-
- if (postCollection[NameAttribute] == postDataKey) {
- Checked = true;
- } else {
- Checked = false;
- }
+ string value = postCollection [NameAttribute];
+ bool checkedOnClient = value == ValueAttribute;
+#if NET_2_0
+ ValidateEvent (NameAttribute, value);
+#endif
+ if (Checked == checkedOnClient)
+ return false;
- if (old_checked != Checked) {
- return (true);
- } else {
- return (false);
- }
+ Checked = checkedOnClient;
+ return checkedOnClient;
}
#if NET_2_0
- protected override
-#endif
- void RaisePostDataChangedEvent ()
+ protected override void RaisePostDataChangedEvent ()
{
-#if NET_2_0
if (CausesValidation)
Page.Validate (ValidationGroup);
-#endif
OnCheckedChanged (EventArgs.Empty);
}
-
+#endif
+
bool IPostBackDataHandler.LoadPostData (string postDataKey, NameValueCollection postCollection)
{
return LoadPostData (postDataKey, postCollection);