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 6668175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:00:43+00:00 2026-05-26T03:00:43+00:00

Hello all I have a project where I need to perform single value bindings

  • 0

Hello all I have a project where I need to perform single value bindings from a collection. I am trying to create an asp.net web form website with a certain degree of separation without going to mvc. Within the site I have a page that invokes a method from a web service. This method returns a result collection. The page is designed to show the data in a structured layout vs grid or form view. Can someone point me in the right direction (links or sample ) upon how to perform single value bindings against a collection result in asp.net.

update

Just for clarification, the method will return a collection within that collection I have the following properties (FirstName LastName Height Weight). Is it possible to bind the collection to a section within the page and then within that section display a certain property?

<div id="section1" DataSource="peopleCollection">
  <%# LastName %><br/>
  <span>Height: <%# Height %></span><br/>
  <span>Weight: <%# Weight %></span>
</div>

I’d like to do this using web forms and a pseudo implementation of MVC without using the MVC framework

Thanks in advance

  • 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-26T03:00:44+00:00Added an answer on May 26, 2026 at 3:00 am

    Is ‘peopleCollection’ have a single element or multiple elements where each element has properties that need to be data-bound? If yes then you should able to use data bound control such as ListView/Repeater. What exactly is the issue here?

    Or do you mean that ‘peopleCollection’ is really a dictionary (collection of name-value pairs) – so you have threes key into the dictionary i.e. height, wight and last-name? In such case, you can create dummy array with single element and bind it with repeater/list-view. For example,

    in code-behind

    // Assuming propertyCollection supports IDictionary<string, string>
    var dummyArray = new IDictionary<string, string>[] { propertyCollection };
    myControl.DataSource = dummyArray;
    ...
    protected string GetValue(IDataItemContainer container, string propertyName)
    {
       var properties = container.DataItem as IDictionary<string, string>;
       return properties[propertyName];
    }
    

    in mark-up

    <asp:Repeater ID="myControl" runat="server">
     <asp:ItemTemplate>
       <div id="section1" DataSource="peopleCollection">
         <%# GetValue(Container, "LastName") %><br/>
         <span>Height: <%# GetValue(Container, "Height") %></span><br/>
         <span>Weight: <%# GetValue(Container, "Weight") %></span>
       </div>
     </asp:ItemTemplate>
    </asp:Repeater>
    

    EDIT:
    For single element (with respective properties), you can still use repeater based approach. All you have to do is to put a single element array (or any enumerable collection) and bind with the repeater (or similar control).

    But really speaking, you don’t really need data-binding with single element. You can also use markup such as

    <div id="section1">
      <%= People.LastName %><br/>
      <span>Height: <%= People.Height %></span><br/>
      <span>Weight: <%= People.Weight %></span>
    </div>
    

    where People is a protected/public property exposing the single element.

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

Sidebar

Related Questions

hello all i have code from open source project that im integrating into my
hello all i really need your help its my final project in university i
Hello internet techno-persons, I am writing a project for users to create documents from
hello all I have a small dialog which I created dynamically, which has a
Problem Hello all! I have this code which takes my jpg image loops through
Hallo all. if i have week number 42 and i need to know what
NOTE: Using .NET 2.0, and VS2005 as IDE Hello all, I'm working on logging
Hello! I would like to extract all citations from a text. Additionally, the name
Possible Duplicate: Creating makefile Hello, I am trying to create the makefiles and configure
Hello everyone I have converted a project in C# to F# that paints the

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.