473,695 Members | 2,360 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e's underlying data/schema

How do I get to an ObjectDataSourc e's underlying data/schema. I thought it
would have a DataSet property but I can't find it. So how do you find out
about the data and/or the schema used to populate a bound control such as the
GridView?

Specifically I want to do something like this...

For Each BoundControl in GridView1
If the DataType of the BoundControl is DateTime Then
BoundControl.Ht mlEncode="false "
BoundControl.Da taFormatString= "{0:d}"
End If
Next BoundControl

I thought I would find a property on the BoundControl that would lead me to
a DataRow object. Or otherwise perhaps I could use the BoundControl's ordinal
to find the corresponding DataColumn from the DataSet's DataTable object. But
I can't see how to do any of these things.
Mar 1 '06 #1
2 1823
You can use the DataItem property of the GridViewRow as you handle the
GridView.RowDat aBound event:
http://msdn2.microsoft.com/en-us/lib....dataitem.aspx

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Dick" wrote:
How do I get to an ObjectDataSourc e's underlying data/schema. I thought it
would have a DataSet property but I can't find it. So how do you find out
about the data and/or the schema used to populate a bound control such as the
GridView?

Specifically I want to do something like this...

For Each BoundControl in GridView1
If the DataType of the BoundControl is DateTime Then
BoundControl.Ht mlEncode="false "
BoundControl.Da taFormatString= "{0:d}"
End If
Next BoundControl

I thought I would find a property on the BoundControl that would lead me to
a DataRow object. Or otherwise perhaps I could use the BoundControl's ordinal
to find the corresponding DataColumn from the DataSet's DataTable object. But
I can't see how to do any of these things.

Mar 1 '06 #2
Thanks for Phillip's informative input.

Hi Dick,

As Phillip has mentioned, generally if we want to do some custom tasks to
format the data which will be bound to the Databound controls, we can use
those template databound's (Item)DataBound event. e.g the GridView has the
"RowDataBou nd" event. There we can get the reference to the bound
datasource's dataitem and query data from it...

Also, as for ObjectDataSourc e control, it can be used to associate
different kind of data access component classes, not only limited to
TableAdapter/Dataset. So the customization about the databound control or
user interface is not related to the objectDataSourc e.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Mar 1 '06 #3

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

Similar topics

5
1984
by: Ole M | last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0. I have a wrapper that contains the static methods for Select and Update. The Update-method takes the business object as parameter. When the Update-method is invoked by the ObjectDataSource, the object referenced is not the same object returned by the Select-method, but a new object with only the values from the Edit-template. So basically I get a reference to a useless...
2
6261
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" SelectMethod="GetUsers" TypeName="BizObject"></asp:ObjectDataSource> This works, however I need to explicitly clear/remove the cache when I
2
5638
by: SJL | last post by:
I have a GridView (ASP.NET 2.0 + SQL Sever 2005) control that is bound to an Object Data Source (ODS). The ODS has a SelectParameter for the sort expression. The SelectParameter has a DefaultValue defined, however when the page intitially loads, that DefaultValue is not passed to my SelectMethod. I have sorting enabled, so when I do subsequent sorts on the GridView, the pSortExpression value is passed and sorting works, but for some reason,...
0
1158
by: Richard Carpenter | last post by:
I am working on a small project in which I am trying to implement a data access layer through the use of a project dataset schema. Data integrity and normalization will be handled through the use of SQL Server stored procedures. Basically, for each data entity, I've written _Get(), _Delete(), _Add() and _Update() stored procedures. The _Get() procs return all data needed to display the information in a meaningful manner to the user...
10
4567
by: J055 | last post by:
Hi I've been trying out SqlCacheDependency using the ObjectDataSource and SQL Server 2005. It all works quite well with the minimum of configuration, e.g. <asp:ObjectDataSource ID="odsAccounts" runat="server" ... EnableCaching="true" SqlCacheDependency="CommandNotification"> .... </asp:ObjectDataSource>
14
14641
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
6
5744
by: =?Utf-8?B?V2F5RG93blVuZGVy?= | last post by:
When I link an ObjectDataSource to a business object, it appears that the Refresh Schema button does nothing. I have added a property to the business object and want to display this new property on a gridview attached to my ObjectDataSource. Tried all things including build/rebuild. Delete objectdataSource add in again. Still not working. Any info would help
0
1432
by: yisroem | last post by:
Hi Everybody, I am just getting to grips with ASP.NET 2.0. as per my reading I understand that it is possible for a data control (such as the GridView, DetailsView etc.) to reflect upon the object that it is connect to, and refresh its columns according to the properties of the object. In reality, though, when I connect the ObjectDataSource to an object (VB Class) and then select Refresh Schema on the smart tag I get an
1
1315
by: Axel Dahmen | last post by:
Hi, I'd like to retrieve and step through an ObjectDataSource's columns to be able to manually add BoundFields to a GridView control. I don't know how to do this other than to manually call the ObjectDataSource's Select() method. But this also retrieves all the data, which I don't want to get at that time. Your help is quite appreciated.
0
9132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9004
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8864
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8838
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7682
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6506
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2288
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1986
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.