{
public class ScriptBehaviorDescriptor : ScriptComponentDescriptor
{
- string _elementID;
string _name;
public ScriptBehaviorDescriptor (string type, string elementID)
: base (type) {
if (String.IsNullOrEmpty (elementID))
throw new ArgumentException ("Value cannot be null or empty.", "elementID");
- _elementID = elementID;
+ ElementIDInternal = elementID;
}
public override string ClientID {
public string ElementID {
get {
- return _elementID;
+ return ElementIDInternal;
}
}
}
protected internal override string GetScript () {
- return String.Format ("$create({0}, {1}, {2}, {3}, $get(\"{4}\"));", Type, GetSerializedProperties (), GetSerializedEvents (), GetSerializedReferences (), ElementID);
+ return base.GetScript ();
}
}
}
{
public class ScriptComponentDescriptor : ScriptDescriptor
{
+ string _elementID;
string _type;
string _id;
Dictionary<string, string> _properties;
}
}
+ internal string ElementIDInternal {
+ get {
+ return _elementID;
+ }
+ set {
+ _elementID = value;
+ }
+ }
+
public virtual string ID {
get {
if (_id == null)
}
protected internal override string GetScript () {
- return String.Format ("$create({0}, {1}, {2}, {3});", Type, GetSerializedProperties (), GetSerializedEvents (), GetSerializedReferences ());
+ if (String.IsNullOrEmpty (ElementIDInternal))
+ return String.Format ("$create({0}, {1}, {2}, {3});", Type, GetSerializedProperties (), GetSerializedEvents (), GetSerializedReferences ());
+ else
+ return String.Format ("$create({0}, {1}, {2}, {3}, $get(\"{4}\"));", Type, GetSerializedProperties (), GetSerializedEvents (), GetSerializedReferences (), ElementIDInternal);
}
internal static string SerializeDictionary (Dictionary<string, string> dictionary) {
return sb.ToString ();
}
- internal string GetSerializedProperties () {
+ string GetSerializedProperties () {
return SerializeDictionary (_properties);
}
- internal string GetSerializedEvents () {
+ string GetSerializedEvents () {
return SerializeDictionary (_events);
}
- internal string GetSerializedReferences () {
+ string GetSerializedReferences () {
return SerializeDictionary (_references);
}
}
{
public ScriptControlDescriptor (string type, string elementID)
: base (type) {
- throw new NotImplementedException ();
+ if (String.IsNullOrEmpty (elementID))
+ throw new ArgumentException ("Value cannot be null or empty.", "elementID");
+ ElementIDInternal = elementID;
}
public override string ClientID {
get {
- throw new NotImplementedException ();
+ return ElementID;
}
}
public string ElementID {
get {
- throw new NotImplementedException ();
+ return ElementIDInternal;
}
}
public override string ID {
get {
- throw new NotImplementedException ();
+ return base.ID;
}
set {
- throw new NotImplementedException ();
+ throw new InvalidOperationException ("The 'ID' property on ScriptControlDescriptor is not settable. The client ID of a script control is always equal to its element ID.");
}
}
}