Я пытаюсь получить значение из gridview, но получаю пустую строку.
это пользовательский интерфейс:
<asp:GridView runat="server" ID="GroceryGrid"
ItemType="DAL.Grocery" DataKeyNames="GroceryId"
SelectMethod="GroceryGrid_GetData"
AutoGenerateColumns="false" CssClass="table table-responsive" AutoGenerateDeleteButton="True"
AutoGenerateEditButton="True" OnRowDeleting="GroceryGrid_RowDeleting"
OnRowEditing="GroceryGrid_RowEditing" OnRowUpdating="GroceryGrid_RowUpdating">
<Columns>
<asp:DynamicField DataField="GroceryName" HeaderText="GroceryName"/>
<asp:DynamicField DataField="Cup" HeaderText="Cup" />
<asp:DynamicField DataField="Spoon" HeaderText="Spoon" />
<asp:DynamicField DataField="Gram" HeaderText="Gram"/>
<asp:DynamicField DataField="Piece" HeaderText="Piece"/>
</Columns>
</asp:GridView>
и получение данных правильно
protected void GroceryGrid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = GroceryGrid.Rows[e.RowIndex];
int groceryId = Convert.ToInt32(GroceryGrid.DataKeys[e.RowIndex].Values[0]);
string imeNamirnice = row.Cells[0].Text;
double salica = Convert.ToInt32((row.Cells[2].Text));
double zlica = Convert.ToInt32((row.Cells[3].Text));
double gram = Convert.ToInt32((row.Cells[4].Text));
double komad = Convert.ToInt32((row.Cells[5].Text));
using (RwaContext update = new RwaContext())
это часть кода, которая пытается получить значение из ячеек, но я получаю пустые значения, такие как
string imeNamirnice = row.Cells[0].Text;
, она возвращает: "" - пустая строка