Я пытаюсь выбрать значение из gridview, но я возвращаю пустую строку.Почему значение ячейки сетки возвращает пустую строку?
<asp:GridView ID="GridViewLedger" runat="server" Width="100%" AutoGenerateColumns="False"
ShowFooter="True" DataKeyNames="AccountID" OnRowCommand="GridViewLedger_RowCommand"
CssClass="table table-hover table-striped table-bordered">
<Columns>
<asp:TemplateField HeaderText="InvoiceNo" SortExpression="InvoiceNo">
<ItemTemplate>
<asp:LinkButton ID="btnClickInvoiceNo" runat="server" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" CommandName="InvoiceNo" Text='<%# Eval("InvoiceNo") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Я удалил все ненужные столбцы здесь,
protected void GridViewLedger_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index = Convert.ToInt32(e.CommandArgument);
string InvoiceNo = GridViewLedger.Rows[index].Cells[4].Text;
}
Вы пробовали отладки, чтобы увидеть, какие значения строка имеет? – RePierre
Да, он возвращает 1, как и ожидалось –