N
Nathan Sokalski
I am trying to set the CommandArgument property of a Button control from a
template in a DataList of mine using code in the ItemDataBound event.
However, it does not want to set the property (it is acting as if I did not
set it). Here is my code that sets the CommandArgument property in the
ItemDataBound event:
CType(e.Item.FindControl("btnMainMoveDown"), Button).CommandArgument =
CStr(CType(Me.datMain.DataSource, DataTable).Rows(e.Item.ItemIndex +
1)("id"))
I have tried using a System.Diagnostics.Debug.Write() statement to make sure
the value I am assigning to the CommandArgument is returning the expected
value, and it is. However, when I try to use the CommandArgument property
through EventBubbling in the ItemCommand event, the e.CommandArgument
property has no value. If I set the CommandArgument attribute in the *.aspx
file as an attribute, it has a value, but I need to set it in the
ItemDataBound event. Am I doing something wrong when setting the property?
Why is the property not getting set? Thanks.
template in a DataList of mine using code in the ItemDataBound event.
However, it does not want to set the property (it is acting as if I did not
set it). Here is my code that sets the CommandArgument property in the
ItemDataBound event:
CType(e.Item.FindControl("btnMainMoveDown"), Button).CommandArgument =
CStr(CType(Me.datMain.DataSource, DataTable).Rows(e.Item.ItemIndex +
1)("id"))
I have tried using a System.Diagnostics.Debug.Write() statement to make sure
the value I am assigning to the CommandArgument is returning the expected
value, and it is. However, when I try to use the CommandArgument property
through EventBubbling in the ItemCommand event, the e.CommandArgument
property has no value. If I set the CommandArgument attribute in the *.aspx
file as an attribute, it has a value, but I need to set it in the
ItemDataBound event. Am I doing something wrong when setting the property?
Why is the property not getting set? Thanks.