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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:01:28+00:00 2026-05-29T10:01:28+00:00

I am trying to create a DataBoundControlAdapter for the ListBox Control, but for some

  • 0

I am trying to create a DataBoundControlAdapter for the ListBox Control, but for some reason its not firing the PerformDataBinding method in my DataBoundControlAdapter.

According to the MSDN Documentation:

The PerformDataBinding method is called in place of the
DataBoundControl.PerformDataBinding method when a
DataBoundControlAdapter control adapter is attached to a control
derived from the DataBoundControl class.

Which is not happening at all, any ideas?

Here is basically how it works.

BrowserFile:

<browsers>
  <browser refID="Default">
    <controlAdapters>
      <adapter
          controlType="System.Web.UI.WebControls.ListBox"
          adapterType="SomeNameSpace.ListBoxDataAdapter" />
    </controlAdapters>
  </browser>
</browsers>

The Adapter:

namespace SomeNameSpace
{
    public class ListBoxDataAdapter : DataBoundControlAdapter
    {
        protected override void PerformDataBinding(System.Collections.IEnumerable data)
        {
            base.PerformDataBinding(data); // Not firing
        }
    }
}

On the page:

<asp:ListBox runat="server" ID="lbxStuff" DataSourceID="obsStuff" DataValueField="Value"
    DataTextField="Text></asp:ListBox>
<asp:ObjectDataSource runat="server" ID="obsStuff" TypeName="Test" SelectMethod="Get">
</asp:ObjectDataSource>
  • 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-29T10:01:29+00:00Added an answer on May 29, 2026 at 10:01 am

    The DataBoundControl (base class for the ListControl/ListBox) contains a method called PerformSelect, this method retrieves data from the adapter (if one exists that is)

    But whoever (at microsoft) that created the ListControl overrode the PerformSelect method and didnt include the adapter in their override, thereby removing the adaptability – thanks to this you wont be able to simply create your own PerformDataBinding method like nature intended.

    All is not lost though, in your DataBoundControlAdapter you can attach to the databinding method of the ListBox get the ObjectDataSource, retrieve the data “manually”, call the PerformDataBinding method and then cancel the ObjectDataSource from being called again (else whatever you do will be overriden).

    Like seen in the following ugly “hack”.

    void listBox_DataBinding(object sender, EventArgs e)
    {
        ObjectDataSource ods = listBox.DataSourceObject as ObjectDataSource;
        if (ods != null)
        {
            IEnumerable data = ods.Select();
            PerformDataBinding(data);
            ods.Selecting += (s, ev) => { ev.Cancel = true; };
        }
    }
    

    I would almost be inclined to say that you’ll be better off by “sub classing” the ListBox, but since you’re using an Adapter I guess thats something you dont really want to do?

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

Sidebar

Related Questions

I am trying create alert dailog using glade,but its not working .am i doing
I am trying create a delegate representation of constructor by emitting a Dynamic Method,
Trying to create a user account in a test. But getting a Object reference
Trying to create a list to return some JSON data to a view. Following
I'm trying create a RCP Application with Eclipse, but I can't get past the
I'm trying create a new file with a Java Applet, but I don't know
I'm trying create a small http proxy service. This is not working so well.
Trying to create an array of structs (new to C), but I am getting
Trying to create a request only to have a runtime error thrown. Method initiating
I am trying create a new css for shaping my detailsview. But i couldn't

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.