I have a GridView with bound rows from a data source and I placed a link button at the end of each row. When I click that link button I would find the named controls within the grid and get their values. I decided to try and use a Repeater control with the same named controls in the Repeater and same data source but I am not able to execute the same click event and use RepeaterItemEventArgs, only EventArgs is available in the method signature. Without the RepeaterItem I can't find the control.
This code compiles but when I click the row I get this error: CS0123: No overload for 'BtnAssign' matches delegate 'System.EventHandler' So I discovered that what I needed was to change the second parameter to EventArgs. This fixes the error at run time and I am able to step into this method but the method has to be changed in order to compile. I no longer have access to e.Item. Ideas?
protected void BtnAssign(object sender, RepeaterItemEventArgs e)
{
var miscItem = new SLWorkOrderItem();
string theAmountLabelText = "";
// Repeater Code
if (e.Item.ItemType == ListItemType.Item)
{
var theAmountLabel = e.Item.FindControl("lblAmount") as Label;
}
}
GridViewand aRepeaterhave different arguments for that event. You might be better off with having the be separate functions. - gunr2171