Textbox value in the edittemplate of a datalist doesn't report the changes

Discussion in 'ASP .Net Web Controls' started by Antonio D'Ottavio, Sep 26, 2005.

  1. Good Morning,
    I've a problem with a textfiled inside a datalist, in particular it's value
    it is not updated with the changes,
    I mean sNomeCampo has still the value coming from the dB and not that
    changed by the user,
    May you help me ???

    Antonio D'Ottavio
    www.etantonio.it/en

    Here's the code :


    void Update_Command(Object sender, DataListCommandEventArgs e)
    {
    String sNomeCampo =
    ((TextBox)e.Item.FindControl("NomeCampo")).Text;
    }



    <ASP:DataList id="MyDataCampi" runat="server" HorizontalAlign="Center"
    RepeatDirection="Horizontal" RepeatColumns="1"
    OnEditCommand="Edit_Command" OnUpdateCommand="Update_Command"
    OnDeleteCommand="Delete_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='<%# DataBinder.Eval(Container.DataItem,
    "NomeCampo") %>'
    runat="server"/>
    </td>
    </EditItemTemplate>

    </ASP:DataList>
     
    Antonio D'Ottavio, Sep 26, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Antonio D'Ottavio
    Replies:
    2
    Views:
    2,134
    =?Utf-8?B?RWx0b24gVw==?=
    Sep 26, 2005
  2. Gönen EREN

    Accesing Items in datalist edittemplate

    Gönen EREN, Aug 22, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    629
    Gönen EREN
    Aug 22, 2003
  3. Peter
    Replies:
    1
    Views:
    342
    Peter
    Jul 2, 2009
  4. ErwinP
    Replies:
    1
    Views:
    750
    ErwinP
    Aug 19, 2005
  5. ES
    Replies:
    0
    Views:
    933
Loading...

Share This Page