Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
665
WebDataTree Eval Into CommandArgument
posted

Hello All,

I'm using a WebDataTree with templates and a WebHierarchicalDataSource. One of my templates uses an image button. I am trying to set the CommandArgs to the node's ID so that I can perform a delete on the server. For some reason when I postback to the server, I can't see the CommandArguments. I must be doing the eval wrong for this, although I am able to set the text of a simple lable with the same eval and I see the ID just fine.

Any help would be appreciated.

Doesn't Work

Client:

 <asp:ImageButton runat="server" ID="lbActivityDelete" OnClick="lbActivityDelete_Click" ImageUrl="~/images/Delete16.png"
AlternateText="Delete Activity" CommandArgument='<%# Eval("ID") %>' ToolTip="Delete Activity" />

Server:

 ((LinkButton)sender).CommandArgument;

This Works

 <asp:Label Text='<%# Eval("ID")%>'  runat="server" />