• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3538
  • Last Modified:

No overload for 'dg_Slate_OnItemDataBound' matches delegate 'System.Web.UI.WebControls.DataGridItemEventHandler'

I have a datagrid
<asp:datagrid ID="dg_Slate" runat="server" onItemDataBound="dg_Slate_OnItemDataBound" AutoGenerateColumns="false" Style="position:  relative" DataSourceID="SqlDataSource1">
            <asp:BoundColumn DataField="sponsor_pref" ReadOnly="True"></asp:BoundColumn>
            <asp:BoundColumn DataField="Bin" ReadOnly="True"></asp:BoundColumn>
            <asp:BoundColumn DataField="adesig" ReadOnly="True"></asp:BoundColumn>
I  have the following code for the onItemDataBound event
 protected void dg_Slate_OnItemDataBound(object sender, DataGridCommandEventArgs e)
            if (e.Item.ItemType == ListItemType.AlternatingItem | e.Item.ItemType == ListItemType.Item)
                Label r = (Label)e.Item.FindControl("slate_check_label");

                r.Text = "<input type=radio name = 'myradiogroup' value=" + ((DataRowView)e.Item.DataItem).Row.ItemArray[1].ToString() + ">";
Everything I read says this should work but I get the error listed.
Need help fast.  This is driving me crazy.
1 Solution
DBAduck - Ben MillerPrincipal ConsultantCommented:
Your method should be like this

protected void dg_Slate_OnItemDataBound(object sender, DataGridItemEventArgs e)

instead of DataGridCommandEventArgs.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now