Hi,

I have written a page whose content includes a gridview. This gridview will display the shopping cart of my web app. I have set the columns and one column is a template field set as follows:

<ItemTemplate>
<asp:TextBox runat="server" id="txtChangeQuantity" text='<%# Eval("Quantity") %>'>
</ItemTemplate>

The gridview is bound to the "cart" DataTable (included in the Profile in web.config)

I want to accomplish the following: When the user changes the quantity in the "txtChangeQuantity" textbox of a row and clicks on a button next to it (the next cell), the Profile cart gets updated with the new quantity. However, even though I have tried many ways to get the NEW value that the user types in the quantity text box, I always get either an empty string or the databound original value. I bind the gridview in the Page_Load method checking that it is not a postback i.e. "if not page.ispostback then BIND GRIDVIEW".

I have tried to get hold of the user typed value in various code-behind methods (e.g. rowupdating), using the following generic syntax:

dim tx as string = CType(e.row(index).FindControl("txtChangeQuantity"),textbox).Text or even CType(e.row(index).Cells(4).FindControl("txtChangeQuantity"),textbox).Text

and also tried through client side javascript (which I found on the internet). However I always get an empty string "" or at most the original unedited value. I've tried to put autopostbacks and disabled/enabled the viewstate of the gridview but to no avail.

Now I am starting to wonder if this type of functionality is possible if the gridview is not set as EDITABLE (i.e. with the "Edit" and "Update" buttons).

If it is possible to set the 'txtChangeQuantity' text box as editable and I can get hold of the newly typed value (after a button click in the same row or other method), I would greatly appreciate any help in knowing the method!! Or maybe what I should add/remove in the gridview code....

Thanks very much in advance,
Timothy