[RESOLVED]textbox in GridView not getting new value
using:
-asp.net 2.0
-Visual Studio 2005
I have a gridview and one column has a textbox that can be edited in the gridview at all times. There is no Edit/Update/Delete columns here.
From my business object (List) I'll bind it to the Grid.
If I originally bind the value 3 to this textbox it displays correctly. When I change this 3 to another number, 5 for instance... and then use:
Code:
dim s as string =DirectCast(row.Cells(2).FindControl("QuantityTextBox"), TextBox).Text
to get the new value of 5 and place it back into the List object
the value is still 3 and not 5.
I've used this method many times before and with no problems.
I don't know why it isn't working here.
This is driving me nuts. Any ideas?
markup piece looks like this:
Code:
<asp:TemplateField HeaderText="Quantity">
<ItemTemplate >
<asp:TextBox ID="QuantityTextBox" runat="server" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
Re: textbox in GridView not getting new value
You've used a template field, and put a textbox in there. Good. When are you running that code to read from the textbox? What event?
Re: textbox in GridView not getting new value
[please ignore the mulitple duplicate posts - something with the server was stalling and my clicks ended up - moderator might want to look at the cause and effect of double-clicking the 'Submit post' button.)
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
i should be able to run this code at any time to get the value from the textbox.
Code:
for each row as gridviewrow in gridview1.rows
dim sNewValue as string = ctype(row.cells(2).findcontrol("mytextbox"),textbox).text
next
I have done it this way in the past without a hitch...
Re: textbox in GridView not getting new value
Is the gridview being repopulated in the Page Load event without a postback check?
Re: textbox in GridView not getting new value
It was in fact that the gridview was being repopulated in the Page Load - thank you mendhak!
Re: [RESOLVED]textbox in GridView not getting new value
Woohoo, I can read minds without reading code!