In the rpt_ItemCommand repeater, the rpt_ItemCommand event e.Item.DataItem always null.
rpt_ItemCommand
e.Item.DataItem
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 for ItemDataBound ... its designed by Microsoft.
Consider using CommandArgument.
<asp:LinkButton ToolTip="Delete" CommandArgument='<%#Eval("Id") %>' ....
and use it in ItemCommand Event as
int id = Convert.ToInt32(e.CommandArgument);
Source: https://habr.com/ru/post/1492642/More articles:Doesn't display VU-meter calibration chart using HighCharts in Durandal - javascriptHow to assign values ββto several properties of a class, for example, a list of elements used for a loop? - c #Why make an interrupt handler like static.is necessary - cwhich leads to the fact that the "built-in method does not work for the Chrome browser"? - javascriptRound pandas datetime index? - python-2.7returning a structure without its impact - c ++WPF dataGrid super Header for multiple columns - wpfTime display format - c #PhoneGap Build app does not trigger battery related events - javascript-eventsPython / Django writes u '' String To Postgresql (with UTF8 DB) and Munges record - pythonAll Articles