Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 994423
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:34:27+00:00 2026-05-16T06:34:27+00:00

I have a ListView (in an update panel) bound to an ObjectDataSource (connected to

  • 0

I have a ListView (in an update panel) bound to an ObjectDataSource (connected to an NHibernate object) and in the EditItemTemplate I use

Text='<%# Bind("HideLocation")%>' 

to bind to a string property of the object.

When I click edit (twice, another issue I’m having) and view the code in Chrome, the output looks like this:

<div class="InputLine InputLineLevel2">
    <div class="InputLabel">Hide Location:</div>
    <div class="InputControl">
     "
                        In locker 2317"
        <input 
            name="ctl00$MainContentPlaceholder$ItemDetailsListView$ctrl0$txtItemHideLocation"
            type="text"
            maxlength="128"
            id="ctl00_MainContentPlaceholder_ItemDetailsListView_ctrl0_txtItemHideLocation"
            style="width:300px;">
    </div>
</div>

The .aspx code looks like this:

 <asp:UpdatePanel ID="ItemDetailsUpdatePanel" UpdateMode="Always" runat="server">
    <asp:ListView ID="ItemDetailsListView" runat="server" ...>
         <EditItemTemplate>
             <fieldset class="FieldsetLevel2">
             <legend>Edit Item: <%# Eval("SearchItem.SearchItemName") %></legend>
                 <div class="InputLine InputLineLevel2">
                     <div class="InputLabel">Hide Location:</div>
                     <div class="InputControl">
                         <asp:TextBox ID="txtItemHideLocation" Width="300px"
                             Text='<%# Bind("HideLocation")%>'
                             runat="server"></asp:TextBox>
                     </div>
                 </div>
... a bunch of other controls & end tags

Any ideas why the value of the bound data (in this case: In locker 2317) is showing up outside of the text box instead of as the contents of the data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:34:27+00:00Added an answer on May 16, 2026 at 6:34 am

    Well, I found a solution, and it’s an interesting one. I also provided false information in my original question, and that might have made all the difference.

    I moved all my code into a separate project and pared it down to just the basics. I was still having to click buttons twice to get a refresh, and the text was still outside the TextBox. I finially found someone describing a different problem that made me realise I was not binding to an object datasource. I was binding a control inside the ListView, but not the listview itself. The listview was bound to the ISet returned from one of my data model objects.

    So, the problem was that (apparently, I’ll explain why I’m not convinced below) when you’re not using an xDataSource control, you need to databind whenever you change the state of the ListView. I imagine this concept ports to other data controls as well, in fact I know I’ve run into it before with other DataBound controls.

    What seemed to be different this time, and why I didn’t clue in right away, was because it almost worked. The event fires on the first postback, and the EditItemIndex is set. This has no effect on the display (despite happening before the PreRender event) so I’m guessing it has to do with the interaction between the event model and the internal workings of the ListView control. On second postback however (clicking the button again) the event was not fired, but the display was updated (with data from my datasource, albeit not where I wanted it to be).

    When I modified my code to databind after changing the EditIndex, not only did it remove the need for the second postback, but it placed the databound text inside the TextBox, instead of before it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI, is it possible to have a listview with datapager inside an update panel
I have a ListView inside of an Update Panel and wanted to change the
I have a listview which has its datasource changed after update of a search
I have a ListView in main.xml where android:entries=@array/list1 and I'd like to update that
I have to update a ListView item by clicking on a button. How do
I have ListView that has the following EditItemTemplate: <EditItemTemplate> <tr style=> <td> <asp:LinkButton ID=UpdateButton
I have form with dateTimeField, and ListView. ListView looks like that: final ListView<String> countryView
I have a ListView and ObservableCollection in my wpf application. I want to bind
I have a ListView in which each item has a SeekBar. When I update
I have a ListView in a ListActivity that's bound to some data. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.