473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

ObjectDataSource - possible to bind to indexer or indexed property?

KJ
Hello all,

I have several objects which use indexers, such as (in C#):

public string this[string FieldName]
{
get
{
return BaseEntity[FieldName];
}
}

Is it possible to bind to these values, or, alternatively, those of a
property which is a StringDictionary, to an ObjectDataSource/GridView?

Mar 29 '07 #1
1 1788
Hi there,

<asp:ObjectDataSource runat="server" ID="ds"
SelectMethod="MethodReturningStringDictionary"
TypeName="YourClass">
</asp:ObjectDataSource>

<asp:GridView runat="server" ID="gv" DataSourceID="ds"
AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Value" />
<asp:BoundField DataField="Key" />
</Columns>
</asp:GridView>

Hope this helps
--
Milosz
"KJ" wrote:
Hello all,

I have several objects which use indexers, such as (in C#):

public string this[string FieldName]
{
get
{
return BaseEntity[FieldName];
}
}

Is it possible to bind to these values, or, alternatively, those of a
property which is a StringDictionary, to an ObjectDataSource/GridView?

Mar 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Vera | last post by:
Hi, I built a user control myPanel derived from the Panel class. In myPanel I added code for an indexer which looks like this: private Color mColor = new Color; public Color this
5
by: Trail Monster | last post by:
Ok, I've been searching the net now for several days and can't find how to do this anywhere. Version: VS 2005 Professional Release, 2.0 Framework Background: I have a complex business object...
2
by: Kjetil Klaussen | last post by:
Hi, I’m having some troubles trying to bind my dataset to a GridView control through an ObjectDataSource control. The binding works fine for regular columns in my dataset, but I can’t seem...
2
by: Phil | last post by:
I have a datalist (DataList1)... with an itemtemplate... then a table - server side (Table1)... then another datalist (DataList2)... another itemtemplate... another table - server side (Table2)...
0
by: Phil | last post by:
Environment: XP sp2 VS.Net 2005 (Asp.Net 2.0 - c#) Sql Server 2005 Scenario: -Table (Table1) with two columns: Table1Id <- Primary Key Column1
3
by: Michael Matteson | last post by:
I have two classes. Class A and Class B. I give class A 5 properties int prop1(){} int prop2(){} int prop3(){} int prop4(){} classB prop5(){} what i would like to do is to create a 5th...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several...
2
by: Aamir Ghanchi | last post by:
Hi, Why does the Update method of an ObjectDataSource class requires parameters for each of the Bind input controls of a FormView? I have a class (say MyObjectDataSource) that is being used as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.