asp.net 2.0 datagrid - update cannot get text out of textbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

New to 2.0, using code that works in 1.1, and all works well except cannot
get the text out of the textboxes for updating the database.

My template column looks like this:

<asp:TemplateColumn HeaderText="Notes"
ItemStyle-HorizontalAlign="Center">
<ItemStyle VerticalAlign="Top"></ItemStyle>
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "CarlileNotes")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" id="txtNotes" Width="300"
MaxLength="1000" CssClass="clsBody" Text='<%#
Container.DataItem("CarlileNotes") %>' />
</EditItemTemplate>
</asp:TemplateColumn>

My code behind looks like this:

sNotes = CType(e.Item.FindControl("txtNotes"), TextBox).Text.Trim

It runs without errors but sNotes does not contain the text from the text
box.

Any help is appreciated.
 
Figured it out....didn't have "If Not Page.IsPostBack Then fill the grid" in
my Page_Load event.
 
Hello cindy,

Yes, but take into account that leds the postback of the whole page. And
for grid with 10 edit fields it will be 10 postbacks.
I'd recomend u use Responce.Form to get the text from your controls when
u press submit in your grid
In that case u get only one postback

c> Figured it out....didn't have "If Not Page.IsPostBack Then fill the
c> grid" in my Page_Load event.
c>
c> "cindy" wrote:
c>---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 
Back
Top