DetailsView and EditItemTemplate

Last post 06-24-2008 10:11 AM by Pushkar. 5 replies.

Sort Posts:

  • DetailsView and EditItemTemplate

    05-11-2005, 1:55 PM
    • Member
      25 point Member
    • ahmeddami
    • Member since 05-11-2005, 5:42 PM
    • Posts 5

    Hi,

    I have a DetailsView associated with an objectdatasource with many rows. I have problems with a row decalred as Template fields. My code looks like

    <asp:TemplateField HeaderText="First Name" >

    <ItemTemplate>

    <asp:Label ID="Label1" runat="server" Text='<%# Eval("FirstName") %>'></asp:Label>

    </ItemTemplate>

    <EditItemTemplate>

    <asp:TextBox ID="FirstNameID" Runat="server"

    Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'/>

    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Runat="server"

    ErrorMessage="You must provide a First Name."

    ControlToValidate="FirstNameID"> *</asp:RequiredFieldValidator>

    </EditItemTemplate>

    </asp:TemplateField>

     

    My Problem is that when trying to update the detailsview. When calling my function the does the update the FirstName is always empty no matter what I put in it. And all the other bound fields look goog

    The UpdateParamater section looks like:

     

    <UpdateParameters >

    <asp:Parameter Name="FirstName" Type="String" />

    </UpdateParameters>

     

  • Re: DetailsView and EditItemTemplate

    05-11-2005, 3:20 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    Hello.

    On your detailsview control replace the DataBinder.Eval with Bind so that you have a 2 way binding. You don't need to add a parameter to the updateparameters property because the detailsview control does that automatically for you.

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: DetailsView and EditItemTemplate

    05-15-2005, 1:53 AM
    • Member
      25 point Member
    • ahmeddami
    • Member since 05-11-2005, 5:42 PM
    • Posts 5
    Thank you Luis Abreu. The Two way binding method "Bind" worked for me.
  • Re: DetailsView and EditItemTemplate

    07-25-2006, 2:12 AM
    • Member
      115 point Member
    • andrianruz
    • Member since 07-25-2006, 5:51 AM
    • Posts 29

    Hi,

    Anybody know what is the missing in the statement below. When I view in browser the page is run okay and no error return, but lblname label is not display the value of the field..

    asp:Label ID="lblName" runat="server" Text='<%# Eval("LAST_NAME") %>' </asp:label>

    Thank you in advance for the help

    Andrian

  • Re: DetailsView and EditItemTemplate

    07-25-2006, 2:13 AM
    • Member
      115 point Member
    • andrianruz
    • Member since 07-25-2006, 5:51 AM
    • Posts 29

    Hi,

    Anybody know what is the missing in the statement below. When I view in browser the page is run okay and no error return, but lblname label is not display the value of the field..

    asp:Label ID="lblName" runat="server" Text='<%# Eval("LAST_NAME") %>' </asp:label>

    Thank you in advance for the help

    Andrian

  • Re: DetailsView and EditItemTemplate

    06-24-2008, 10:11 AM
    • Contributor
      5,699 point Contributor
    • Pushkar
    • Member since 02-17-2006, 2:27 AM
    • Vibrant Gujarat
    • Posts 1,085

     Try this way..

     

    <asp:Label ID="lblName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "LAST_NAME")%>'></asp:Label>
      
    “ There is no great genius without some touch of madness. ”


    Remember to click “Mark as Answer” on the post If you get answer from my post(s) !

    Thanks Guys
    ------------
    Pushkar M Rathod
Page 1 of 1 (6 items)