Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Not updated Textbox value inside a datalist editItemTemplate

Reply
Thread Tools

Not updated Textbox value inside a datalist editItemTemplate

 
 
etantonio@gmail.com
Guest
Posts: n/a
 
      09-27-2005
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:


<ASPataList 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>

</ASPataList>

 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      09-27-2005
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


<> wrote in message
news: 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:
>
>
> <ASPataList 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>
>
> </ASPataList>
>



 
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
User Controls-MasterPages and finding TextBox in DataList EditItemTemplate Hillbilly ASP .Net 2 09-02-2008 03:35 PM
HOWTO: Detect FormView EditItemTemplate TextBox Value Changed =?Utf-8?B?RGFuIFNpa29yc2t5?= ASP .Net 2 10-04-2006 06:54 PM
Not updated Textbox value inside a datalist editItemTemplate etantonio@gmail.com ASP .Net 1 09-27-2005 10:21 AM
Entering DataList EditItemTemplate from Outside of the DataList Luis Esteban Valencia ASP .Net 1 01-06-2005 07:32 PM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57