Apr 07, 2013, 12:41 PM
Just that when it transforms # tag to actual id, it should return NameSpace.ItemId. How do I ensure that?
I want to understand why the following code is inconvenient for you
UserControl
<%@ Control Language="C#" %>
<script runat="server">
protected void Button1_DirectClick(object sender, DirectEventArgs e)
{
TextField1.Text = DateTime.Now.ToShortTimeString();
}
</script>
<ext:TextField ID="TextField1" runat="server" Namespace="Controls" IDMode="Static" />
<ext:Button ID="Button1" runat="server" Namespace="Controls" OnDirectClick="Button1_DirectClick" Text="Set value (server)" />
<ext:Button ID="Button2" runat="server" Namespace="Controls" Handler="#{TextField1}.setValue(new Date().toString());" Text="Set value (client1)" />
<ext:Button ID="Button3" runat="server" Namespace="Controls" Handler="Controls.TextField1.setValue(new Date().toString());" Text="Set value (client2)" />
If you would say that two user controls will raise an exception that TextField1 is already defined then lets imagine that ItemID is used for sharing<ext:TextField ID="TextField1" ItemID="TextField1" runat="server" Namespace="Controls" />
In this case we will not have that exception, shared variable will be Controls.TextField1But if you define two user controls then shared variable of second user control will shadow of variable in first user control, it is the same error (only silent)
So, what advantages give you ItemID? Can you provide a little sample demonstrates ItemID convenience