473,789 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ObjectDataSourc e not refreshing correctly from a business Object

When I link an ObjectDataSourc e 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 ObjectDataSourc e.

Tried all things including build/rebuild. Delete objectdataSourc e add in
again.
Still not working.
Any info would help

--
Life in the sun
Apr 13 '07 #1
6 5759
Hi,

I've done following test on my side and it's working correctly on my side:

1) Create a default web site using File System mode
2) Create a class with following content (placed to App_Code location as
prompted):

using System;
using System.Collecti ons.Generic;
using System.Componen tModel;

namespace myns
{
public class Product
{
private int m_id;

public int Id
{
get { return m_id; }
set { m_id = value; }
}
private string m_name;

public string Name
{
get { return m_name; }
set { m_name = value; }
}
private double m_price;

public double Price
{
get { return m_price; }
set { m_price = value; }
}
private bool m_archived;

public bool Archived
{
get { return m_archived; }
set { m_archived = value; }
}

public Product()
{
}

public Product(int id, string name, double price, bool archived)
{
m_id = id;
m_name = name;
m_price = price;
m_archived = archived;
}
}

[DataObject(true )]
public class ProductDAO
{
private static List<Products_p roducts;

public static List<ProductGet AllProducts()
{
if (s_products == null)
{
s_products = new List<Product>() ;
s_products.Add( new Product(1, "first product", 11.11,
false));
s_products.Add( new Product(2, "second product", 22.22,
true));
s_products.Add( new Product(3, "third product", 33.33,
true));
s_products.Add( new Product(4, "fourth product", 44.44,
false));
}
return s_products;
}

public static Product GetProductById( int id)
{
foreach (Product p in s_products)
{
if (p.Id == id) return p;
}
return null;
}

public static void UpdateProduct(P roduct product)
{
if (s_products == null) throw new
ApplicationExce ption("Products is null");

for (int i = 0; i < s_products.Coun t; i++)
{
if (s_products[i].Id == product.Id)
{
s_products.Inse rt(i, product);
s_products.Remo veAt(i + 1);
return;
}
}
throw new ApplicationExce ption("Invalid product to update");
}

public static void DeleteProduct(P roduct product)
{
if (s_products == null) throw new
ApplicationExce ption("Products is null");
for (int i = 0; i < s_products.Coun t; i++)
{
if (s_products[i].Id == product.Id)
{
s_products.Remo veAt(i);
return;
}
}
}
}
}
3) Compile the web site and add a GridView to Default.aspx, configure to
use the ObjectDataSourc e, the GridView shows 4 columns: Archived, Price,
Id, Name

4) Now add following property in the Product class

private string m_memo;

public string Memo
{
get { return m_memo; }
set { m_memo = value; }
}

5) Compile the web site again, open Default.aspx designer, select the
GridView (make sure no column is selected) and open it's smart tags menu:
select "Refresh Schema", the IDE will prompt:

=====
Refresh Fields and Keys for 'GridView1'

Would you like to regenerate the GridView column fields and data keys using
the selected data source schema? Warning: this will delete all existing
column fields.
=====

Select Yes and the GridView will have the new column "Memo".

Would you please test above steps on your side and let me know the result?
Thanks.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 13 '07 #2
Thanks Walter for the reply,
But my scenario is slightly different.
The Object data source is choosn for the toolbox
The ODS links to another project that has the business logic layer to expose
the getlist.
The getlist access another porject with the model in it.
Under these circumstances it doesnt work

--
Life in the sun
"Walter Wang [MSFT]" wrote:
Hi,

I've done following test on my side and it's working correctly on my side:

1) Create a default web site using File System mode
2) Create a class with following content (placed to App_Code location as
prompted):

using System;
using System.Collecti ons.Generic;
using System.Componen tModel;

namespace myns
{
public class Product
{
private int m_id;

public int Id
{
get { return m_id; }
set { m_id = value; }
}
private string m_name;

public string Name
{
get { return m_name; }
set { m_name = value; }
}
private double m_price;

public double Price
{
get { return m_price; }
set { m_price = value; }
}
private bool m_archived;

public bool Archived
{
get { return m_archived; }
set { m_archived = value; }
}

public Product()
{
}

public Product(int id, string name, double price, bool archived)
{
m_id = id;
m_name = name;
m_price = price;
m_archived = archived;
}
}

[DataObject(true )]
public class ProductDAO
{
private static List<Products_p roducts;

public static List<ProductGet AllProducts()
{
if (s_products == null)
{
s_products = new List<Product>() ;
s_products.Add( new Product(1, "first product", 11.11,
false));
s_products.Add( new Product(2, "second product", 22.22,
true));
s_products.Add( new Product(3, "third product", 33.33,
true));
s_products.Add( new Product(4, "fourth product", 44.44,
false));
}
return s_products;
}

public static Product GetProductById( int id)
{
foreach (Product p in s_products)
{
if (p.Id == id) return p;
}
return null;
}

public static void UpdateProduct(P roduct product)
{
if (s_products == null) throw new
ApplicationExce ption("Products is null");

for (int i = 0; i < s_products.Coun t; i++)
{
if (s_products[i].Id == product.Id)
{
s_products.Inse rt(i, product);
s_products.Remo veAt(i + 1);
return;
}
}
throw new ApplicationExce ption("Invalid product to update");
}

public static void DeleteProduct(P roduct product)
{
if (s_products == null) throw new
ApplicationExce ption("Products is null");
for (int i = 0; i < s_products.Coun t; i++)
{
if (s_products[i].Id == product.Id)
{
s_products.Remo veAt(i);
return;
}
}
}
}
}
3) Compile the web site and add a GridView to Default.aspx, configure to
use the ObjectDataSourc e, the GridView shows 4 columns: Archived, Price,
Id, Name

4) Now add following property in the Product class

private string m_memo;

public string Memo
{
get { return m_memo; }
set { m_memo = value; }
}

5) Compile the web site again, open Default.aspx designer, select the
GridView (make sure no column is selected) and open it's smart tags menu:
select "Refresh Schema", the IDE will prompt:

=====
Refresh Fields and Keys for 'GridView1'

Would you like to regenerate the GridView column fields and data keys using
the selected data source schema? Warning: this will delete all existing
column fields.
=====

Select Yes and the GridView will have the new column "Memo".

Would you please test above steps on your side and let me know the result?
Thanks.
Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 16 '07 #3
Hi,

By moving the Product class to a separate class library, I can now see the
issue on my side.

The only workaround I can find is to close the page's designer and re-open
it, then the "Refresh Schema" should work correctly. Would you please test
if this workaround works for you? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 16 '07 #4
Thanks walter ,
I found by closing the solution and re-opening it was ok
--
Life in the sun
"Walter Wang [MSFT]" wrote:
Hi,

By moving the Product class to a separate class library, I can now see the
issue on my side.

The only workaround I can find is to close the page's designer and re-open
it, then the "Refresh Schema" should work correctly. Would you please test
if this workaround works for you? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 16 '07 #5
Walter,
closing the designer doesnt fix the issue.
The only way I found is close the solution and go back in
--
Life in the sun
"Walter Wang [MSFT]" wrote:
Hi,

By moving the Product class to a separate class library, I can now see the
issue on my side.

The only workaround I can find is to close the page's designer and re-open
it, then the "Refresh Schema" should work correctly. Would you please test
if this workaround works for you? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 16 '07 #6
Hi,

Thanks for the quick update and sharing the workaround with the community.

This looks like a possible issue of current Visual Studio IDE not updating
the referenced assembly after it's rebuilt in IDE. I will help report to
related product team. In the meanwhile, you're also welcome to submit your
feedback at
http://connect.microsoft.com/Main/co...ContentID=2220 which
is monitored by our product team directly. Thanks for your feedback!

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Apr 16 '07 #7

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

Similar topics

5
3485
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 Employee that contains public properties and several nested objects such as a Spouse object and a List of Coverage objects.
4
3425
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void RaiseCallbackEvent(string eventArgs) { // update the data object with the values currently on screen FormView1.UpdateItem(true); }
10
4581
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
14659
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
2
1773
by: Kevin Frey | last post by:
One of my chief criticisms of validators in an ASP.NET page is that they can result in a developer re-implementing much of the "business logic" of a transaction at the page level. Assuming we have an object that implements business logic, and that object is utilised via an ObjectDataSource, I wish to enquire what the correct method is for handling errors from the business logic object. For example, there are some circumstances where a...
1
1706
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 collections of textboxes prompting for entry into a fairly monolithic database. I decided to create a business object (called Employee) and use the ObjectDataSource to broker data being transmitted between the UI and my Employee object (and...
0
1331
by: m.bagattini | last post by:
Hello folks, I'll try to be as much clear as I can. This is my issue: Asp.NET 2.0 page w/ FormView (later: FW), an ObjectDataSource (ODS). It works with my Business logic layer, where I have some methods to retrieve and set data. ODS works with this MyObjectManager object. MyObjectManager has GetObjects that return an ObjectsCollection and so on. Nothing special. MyObject has 3 properties, for example: Color, Description, Size...
0
1887
by: cmrchs | last post by:
Hi, I'm trying out Databinding to a Data Acces Layer using a GridView and ObjectDataSource-control The Update works fine but the Delete-method doesn't ??? <asp:GridView ID="GridView1" runat="server" DataSourceID="ObjectDataSource1" OnRowUpdating="GridView1_RowUpdating"
0
1619
by: fig000 | last post by:
Hi, I'm using an objectdatasource. The insert procedure called by the objectdatasource is in a separate library file outside of the aspx and the codebehind that is using the objectdatasource in question (I guess that separate file would be called a bll). I had originally used the parameter list method to pass the inserted values to thie insert procedure which also gave me the ability to add a retun parameter to access the newly...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10139
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
9020
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
7529
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
6769
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();...
1
4093
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
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.