473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 4529
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.