TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
yokzu
NA
306
0
"Unable to cast object of type 'System.Web.UI.WebControls.DataGridLinkButton" error
Mar 11 2012 1:51 PM
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.
Reply
Answers (
2
)
Insert into access 2007 database
Difference operation in datagridview