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.
The DataItem Property is always null except ItemDataBound... its by design of Microsoft.
Think of using CommandArgument.
<asp:LinkButton ToolTip="Delete" CommandArgument='<%#Eval("Id") %>' ....
and use it in ItemCommand Event as
int id = Convert.ToInt32(e.CommandArgument);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With