Strange, I use autogenerate = false, but it does not work, this is my full code:
<asp:SqlDataSource ID="DSValues" runat="server" DataSourceMode="DataSet" ConnectionString="..." ProviderName="MySql.Data.MySqlClient" SelectCommand="CALL spValues();" UpdateCommand="UPDATE table SET value=?value WHERE id=?id;"> </asp:SqlDataSource> <asp:GridView ID="MyGridView" OnRowUpdating="MyGridViewUpdate" DataKeyNames="id,value" DataSourceID="DSValues" AutoGenerateColumns="false"> <Columns> <asp:BoundField ReadOnly="false" DataField="value" DataFormatString="{0:0.##}" /> <asp:CommandField ShowEditButton="true" EditImageUrl="~/images/iconedit.png" ButtonType="Image" CancelImageUrl="~/images/iconclose.png" UpdateImageUrl="~/images/iconedit.png" /> </Columns> </asp:GridView> //SpValues() is a stored procedure that just do: "SELECT id,value FROM table"
This worked:
(MyGridView.Rows[e.RowIndex].Cells[1].Controls[0] as TextBox).Text
I could just use this, but it would be nice to know how to use "NewValues" instead ...
MrM
source share