Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > always the same text in a textBox in a Gridview

Reply
Thread Tools

always the same text in a textBox in a Gridview

 
 
Andrea
Guest
Posts: n/a
 
      05-14-2008
Hallo,
I'll try to explain me in english.... sorry for my results.

I'm trying to use a gridview update function. (C#) These are my first
experiments in asp.net

I'have this TemplateField

<asp:TemplateField HeaderText="myTesto">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("DATA")
%>' MaxLength="6" Width="37px" CssClass="myclass"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("DATA")
%>'></asp:Label> </ItemTemplate>
</asp:TemplateField>

and the function ...

protected void GridView1_RowUpdating(object sender,
GridViewUpdateEventArgs e)
{
string mynewTest = ((TextBox)(row.Cells[1].Controls[0])).Text;
// I need to control this string
if (check(mynewTesr))
{
//do the update
if (myUpdateFunction())
{
this.GridView1.EditIndex = -1;
//Bind data to the GridView control.
BindData();
}
}
else
{
this.labelTest.Text = mynewTest;
}
}

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}

As you can see, I need to check my string before Updating it end if
something is wrong i control with a label (labelTest).
So in the gredview I have the value "NewYork". I change it (in the
textbox o the TemplateField) with the value "Rome", I submit the
update and in my label there is the always "NewYork"... and also in
the TemplateField,
in the "TextBox1" (we are in edit mode) there is "NewYork".

Can you Help me

Thanks in advance

Andrea



 
Reply With Quote
 
 
 
 
Andrea
Guest
Posts: n/a
 
      05-14-2008
On 14 Mag, 14:11, Andrea <(E-Mail Removed)> wrote:
>.......
> So in the gredview I have the value "NewYork". I change it (in the
> textbox o the TemplateField) with the value "Rome", I submit the
> update and in my label there is the always "NewYork"... and also in
> the TemplateField,
> in the "TextBox1" (we are in edit mode) there is *"NewYork".
> Andrea



Sorry, my fault : I forgot to put EnableViewState="False"

Bye

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox, Input (text) on turbotax... anyone know which 3rd party textbox this is??? pld888@gmail.com ASP .Net 3 02-23-2007 08:51 PM
Gridview sorting event - Gridview Datasource always Null .. why??? jobs ASP .Net Web Controls 2 10-24-2006 07:08 AM
ASP.NET textbox loses text value in composite control but Textbox subclass doesn't!? ErwinP ASP .Net Web Controls 1 08-19-2005 01:50 PM
Trying to create a CSS box that is always is always the width of an image placed inside it (and no wider) Deryck HTML 4 06-22-2004 08:25 PM
writing two textbox's text in one textbox agb ASP .Net Web Controls 1 08-27-2003 12:57 AM



Advertisments