Hi
I usually use expressions like this
CommandArgument='<%# Container.DataItemIndex.ToString() %> '
But I could not find Container in the msdn, can u help?
Thanks
Hi
I usually use expressions like this
CommandArgument='<%# Container.DataItemIndex.ToString() %> '
But I could not find Container in the msdn, can u help?
Thanks
Hi,
Container is usually represented by an object implementing the INamingContainer interface. However, this is not a strict rule. You can read about this in the MSDN:
http://msdn.microsoft.com/en-us/library/bda9bbfx(VS.71).aspx
If you want to know the type of the Container object, I would suggest that you use the following approach:
define the following binding expression:
CommandArgument='<%# GetCommandArgument(Container)%>
and also define the following method in the page's code:
protected string GetCommandArgument(object container) {
return string.Empty;
}
Set the breakpoint in the page's method and check the container's type in the QuickWatch. Hope, this helps...
Container
is a keyword that is only applicable to data binding expressions and is a reference to the naming container.
See this from MSDN (How to: Access Members of a Control's Naming Container):
In the data-binding expression, use the Container keyword, which returns a reference to the container.
And this (Using the NamingContainer Property to Determine a Control's Naming Container):
... the Container keyword, which is available only in inline code (that is, in a declarative <%# %> expression) ...