hi
i'm trying to edit gridview rows.
the grid columns are template cplumns.
i added the commandfield buttons for update.

i wrote a rowupdating event:

MonthTable.Rows[e.RowIndex]["FirstEnter"] = ((TextBox)(MonthGridView.Rows[e.RowIndex].Cells[6].Controls[0])).Text;

on runtime i get this error:
Unable to cast object of type 'System.Web.UI.LiteralControl' to type 'System.Web.UI.WebControls.TextBox'.

what have i done wrong ?

It's not SQL Server error!! rather you should post that on ASP.NET forum.

yes i know :)
i couldnt delete the post

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.