Q
qa4ever
Hi Gridview gurus
I got a Gridview that is populated from Datatable, held in a Session.
Pressing delete successfully deletes the row.
Problem is that pressing Edit, no expected editbox apear instead nothing
happens except for my RowEditingBasket event handler is called and I can
see the value of the gridview that I hoped now had a editobox enabling
editing.
protected void RowEditingBasket(object sender, GridViewEditEventArgs e)
{
String newQuantity =
GridViewBasket.Rows[e.NewEditIndex].Cells[4].Text;
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:GridView ID="GridViewBasket" runat="server"
AutoGenerateDeleteButton="true"
autogeneratecolumns="true"
autogenerateeditbutton="true"
datakeynames="IDRow"
onrowupdating="RowUpdatingBasket"
onrowdeleting="RowDeletingBasket"
Caption="Your basket contain the following items:"
onrowediting="RowEditingBasket" >
<EditRowStyle BackColor="Yellow" />
<AlternatingRowStyle BorderStyle="Inset" />
</asp:GridView>
I.e delete works fine but not updating /editing the same
public void DoRowDeletingBasket ( object o, GridViewDeleteEventArgs e)
{
dt = (DataTable)Session["data"];
dt.Rows.RemoveAt(e.RowIndex);
dt.AcceptChanges(); //commit
Session["data"] = dt;
Thank you,
QA4ever
I got a Gridview that is populated from Datatable, held in a Session.
Pressing delete successfully deletes the row.
Problem is that pressing Edit, no expected editbox apear instead nothing
happens except for my RowEditingBasket event handler is called and I can
see the value of the gridview that I hoped now had a editobox enabling
editing.
protected void RowEditingBasket(object sender, GridViewEditEventArgs e)
{
String newQuantity =
GridViewBasket.Rows[e.NewEditIndex].Cells[4].Text;
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<asp:GridView ID="GridViewBasket" runat="server"
AutoGenerateDeleteButton="true"
autogeneratecolumns="true"
autogenerateeditbutton="true"
datakeynames="IDRow"
onrowupdating="RowUpdatingBasket"
onrowdeleting="RowDeletingBasket"
Caption="Your basket contain the following items:"
onrowediting="RowEditingBasket" >
<EditRowStyle BackColor="Yellow" />
<AlternatingRowStyle BorderStyle="Inset" />
</asp:GridView>
I.e delete works fine but not updating /editing the same
public void DoRowDeletingBasket ( object o, GridViewDeleteEventArgs e)
{
dt = (DataTable)Session["data"];
dt.Rows.RemoveAt(e.RowIndex);
dt.AcceptChanges(); //commit
Session["data"] = dt;
Thank you,
QA4ever