Reputation: 722
In repeater rpt_ItemCommand
Event the e.Item.DataItem
is always null.
Here is the code behind:
protected void rpt_ItemCommand(Object sender, RepeaterCommandEventArgs e)
{
DataRowView drv = (DataRowView)e.Item.DataItem // here the DataItem is Null.
}
Suggest me any solutions.
Upvotes: 5
Views: 4605
Reputation: 79
Think of using CommandArgument.
<asp:LinkButton ToolTip="Delete" CommandArgument='<%#Eval("Id") %>' ....
and use it in ItemCommand Event as
int id = Convert.ToInt32(e.CommandArgument);
Upvotes: 6
Reputation: 722
The DataItem Property is always null except ItemDataBound... its by design of Microsoft.
Upvotes: 9