G
Guest
Hi,
I have a gridview which I added a
<asp:CommandField EditText="E" CancelText="C" UpdateText="U"
ButtonType="Link" ShowEditButton="True" />
my gridview looks like this
<asp:GridView ID="GridView1" runat="server" OnRowEditing="RowEdit"
OnRowCancelingEdit="RowCancel" OnRowUpdating="RowUpdating"...
<Columns>
...
<asp:BoundField DataField="prodid" HeaderText="prodid"
ReadOnly="true" ></asp:BoundField>
<asp:BoundField DataField="quantity"
HeaderText="Quantity">
<asp:CommandField EditText="E" CancelText="C"
UpdateText="U" ButtonType="Link" ShowEditButton="True" />
</Columns>
</asp:GridView>
First issue ...I have to click twice on "E" before the Gridview kicks into
Editing mode. (Note the Gridview is enclosed in an Ajax updatepanel).
Second...most important is, when the gridview is in editing mode I see the
textbox on the quantity column but it's empty. I don't see the original
value. When I enter a new value and click on the "U" for updating I get the
error
Object reference not set to an instance of an object. in my code
Protected Sub RowUpdating(ByVal sender As Object, ByVal e As
GridViewUpdateEventArgs)
With item
...
.Quantity = CType(r.Cells(9).FindControl(0),
TextBox).Text 'r.Cells <-here
End With
Any ideas please. I can seem to find any samples on using the Editing in
Gridview.
Thanks
I have a gridview which I added a
<asp:CommandField EditText="E" CancelText="C" UpdateText="U"
ButtonType="Link" ShowEditButton="True" />
my gridview looks like this
<asp:GridView ID="GridView1" runat="server" OnRowEditing="RowEdit"
OnRowCancelingEdit="RowCancel" OnRowUpdating="RowUpdating"...
<Columns>
...
<asp:BoundField DataField="prodid" HeaderText="prodid"
ReadOnly="true" ></asp:BoundField>
<asp:BoundField DataField="quantity"
HeaderText="Quantity">
<asp:CommandField EditText="E" CancelText="C"
UpdateText="U" ButtonType="Link" ShowEditButton="True" />
</Columns>
</asp:GridView>
First issue ...I have to click twice on "E" before the Gridview kicks into
Editing mode. (Note the Gridview is enclosed in an Ajax updatepanel).
Second...most important is, when the gridview is in editing mode I see the
textbox on the quantity column but it's empty. I don't see the original
value. When I enter a new value and click on the "U" for updating I get the
error
Object reference not set to an instance of an object. in my code
Protected Sub RowUpdating(ByVal sender As Object, ByVal e As
GridViewUpdateEventArgs)
With item
...
.Quantity = CType(r.Cells(9).FindControl(0),
TextBox).Text 'r.Cells <-here
End With
Any ideas please. I can seem to find any samples on using the Editing in
Gridview.
Thanks