"Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton" error
Hi
I am working on a web project and using Datagrid. I want to edit DataGrid and updating DB. When I edit DataGrid's a row and want to process "Update" command, I get "Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton". Codes are below;
------------------------------------
void command_update(object obj, DataGridCommandEventArgs e)
{
DataGrid1.EditItemIndex = e.Item.ItemIndex;
TextBox txt_id = (TextBox)e.Item.Cells[0].Controls[0]; --> Error at this row
...
------------------------------------
And the design side;
------------------------------------
<asp:DataGrid ID="DataGrid1" RUNAT="server" AutoGenerateColumns="False" OnUpdateCommand="command_update" OnEditCommand="komut_edit"
OnCancelCommand="komut_cancel" >
<Columns>
<asp:EditCommandColumn EditText="Edit" CancelText="cancel" UpdateText="Update" HeaderText="Edit" />
<asp:BoundColumn HeaderText="ID" DataField="ID" />
</Columns>
</asp:DataGrid>
-------------------------------
I couldnt solve the problem.
Regards.