473,473 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Not updated Textbox value inside a datalist editItemTemplate

Good Morning,
I still havent solved my problem with a textbox inside an
editItemTemplate
of a datalist,
in fact now it is filled with the word "CIAOOOOOO" , if a runtime in
the
form I put a different word
like "PIZZAAAA" this new word is not available in the Update_Command
following :
void Update_Command(Object sender, DataListCommandEventArgs e)
{
String sNomeCampo =
((TextBox)e.Item.FindControl("NomeCampo")).Text;
}

where instead I've again sNomeCampo = "PIZZA" .
I need help, this problem is stopping my job, many thanks

Antonio D'Ottavio
www.etantonio.it/en

Here's the code inside HTML:
<ASP:DataList id="MyDataCampi" runat="server"
HorizontalAlign="Center"
RepeatDirection="Horizontal" RepeatColumns="1"
OnEditCommand="Edit_Command"
OnUpdateCommand="Update_Command"
OnCancelCommand="Cancel_Command" OnItemDataBound="BindComboes"


<ItemTemplate>
<tr style="background-color:CCFF99">
<td width=10% align="center">
<asp:LinkButton id="EditButton" Text="Edit"
CommandName="Edit" runat="server"/>
<input id="HiddenIDCampo" type="hidden"
value='<%#DataBinder.Eval(Container.DataItem, "IDCampo") %>'
runat="server"
/>
</td>
<td>
<%#
DataBinder.Eval(Container.DataItem,"NomeCampo")%>
</td>
</tr>
</ItemTemplate>

<EditItemTemplate>
<asp:LinkButton id="UpdateButton" Text="Update"
CommandName="Update" runat="server"/>
<td>
<asp:TextBox id="NomeCampo" text='CIAOOOOOOOOOO'
runat="server"/>
</td>
</EditItemTemplate>

</ASP:DataList>

Sep 27 '05 #1
1 4532
When are you populating your DataList?
Is this in the Page_Load.

Often people populate there Grids/Lists in the page load and forget that
when the page reloads this will be populated again.

Your page_load should look as follows

private void Page_Load(object Sender, EventArgs e)
{
if(!Page.IsPostBack) //Emphasis here
{
BindDataList(); //This method binds the list
}
}

If this is not the case, the textbox will be reloaded with its original
value,
and something like you described would happen

Hope that Helps
<et*******@gmail.com> wrote in message
news:11*********************@g47g2000cwa.googlegro ups.com...
Good Morning,
I still havent solved my problem with a textbox inside an
editItemTemplate
of a datalist,
in fact now it is filled with the word "CIAOOOOOO" , if a runtime in
the
form I put a different word
like "PIZZAAAA" this new word is not available in the Update_Command
following :
void Update_Command(Object sender, DataListCommandEventArgs e)
{
String sNomeCampo =
((TextBox)e.Item.FindControl("NomeCampo")).Text;
}

where instead I've again sNomeCampo = "PIZZA" .
I need help, this problem is stopping my job, many thanks

Antonio D'Ottavio
www.etantonio.it/en

Here's the code inside HTML:
<ASP:DataList id="MyDataCampi" runat="server"
HorizontalAlign="Center"
RepeatDirection="Horizontal" RepeatColumns="1"
OnEditCommand="Edit_Command"
OnUpdateCommand="Update_Command"
OnCancelCommand="Cancel_Command" OnItemDataBound="BindComboes"
>


<ItemTemplate>
<tr style="background-color:CCFF99">
<td width=10% align="center">
<asp:LinkButton id="EditButton" Text="Edit"
CommandName="Edit" runat="server"/>
<input id="HiddenIDCampo" type="hidden"
value='<%#DataBinder.Eval(Container.DataItem, "IDCampo") %>'
runat="server"
/>
</td>
<td>
<%#
DataBinder.Eval(Container.DataItem,"NomeCampo")%>
</td>
</tr>
</ItemTemplate>

<EditItemTemplate>
<asp:LinkButton id="UpdateButton" Text="Update"
CommandName="Update" runat="server"/>
<td>
<asp:TextBox id="NomeCampo" text='CIAOOOOOOOOOO'
runat="server"/>
</td>
</EditItemTemplate>

</ASP:DataList>

Sep 27 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mark Brown | last post by:
I'm new to ASP.NET and I'm trying to create an aspx page that retrieves info from a database, let's the user make a change and write the change back. It reads from the database just fine. The...
1
by: headbig003 | last post by:
Hello I put template column in datagrid. Below is the html code I used. <asp:datagrid id="dgAnswer" runat="server" Width="360px" AutoGenerateColumns="False" DataKeyField="ansID"> <Columns>...
1
by: jason | last post by:
I've seen a few posts on this issue, but no clear solutions. I have a mulitiline textbox inside a datagrid. I use TemplateColumn to define as multiline with 3 rows. I have other field types...
1
by: etantonio | last post by:
Good Morning, I still havent solved my problem with a textbox inside an editItemTemplate of a datalist, in fact now it is filled with the word "CIAOOOOOO" , if a runtime in the form I put a...
0
by: mintboy | last post by:
hello thank U for take a look this Message ! /////////////////c# code file private void DataListClass_UpdateCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) {...
0
by: Dan | last post by:
Issue making textbox visible based on specific input from a radio button list in an EditItemTemplate I want to setup a gridview that when in edit mode and when the user selects "Other" from a...
1
by: Landry, Eric | last post by:
I am posting this for a coworker. -------------------------------------------------------- The issue i'm having is after i enter all my data into my gridview's textboxes and dropdownlists the...
1
by: Jim in Arizona | last post by:
On one page I have a datalist where a message is bound to a label. On another page I have the datalist which allows for the insert of new message as well as being able to edit those messages. The...
2
by: Hillbilly | last post by:
Anybody have any sage advice on this frustrating "feature" of ASP.NET? I have a TextBox in the EditItemTemplate of a DataList I can't seem to find for some reason that is I believe related to the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.