Asp.Net - Can a LinkButton.CommandArgument be typed?

Posted by Stimul8d on Stack Overflow See other posts from Stack Overflow or by Stimul8d
Published on 2010-06-15T13:26:43Z Indexed on 2010/06/15 14:22 UTC
Read the original article Hit count: 170

Filed under:
|
|

Okay so given a LinkButton inside a the ItemTemplate of a Repeater declared like this -

<asp:LinkButton ID="restrictionDelete" runat="server" CssClass="restrictionDelete" Text="Delete..."
                OnCommand="lnkDeleteRestriction_Command" CommandName="Delete" CommandArgument="<%# Container.DataItem %>"></asp:LinkButton>

Now,..the repeater is being bound to a list of Restriction objects so when the lnkDeleteRestriction_Command is fired I'm expecting that I can cast the CommandEventArgs.CommandArgument which is an object to my Restriction type. This doesn't seem to be so,..I just get the fully qualified type name as a string.

Can I receive a typed command argument at all and if not, why is it an object?

Thanks in advance,

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about databinding