473,779 Members | 2,001 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 5755
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
3483
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
3424
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
1618
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
9632
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
9471
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,...
0
10302
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
10136
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
10071
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
9925
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
6723
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();...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.