473,327 Members | 1,936 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,327 software developers and data experts.

Select method of ObjectDataSource called twice

Hello,

I have the following code on my ASP.NET page:

<asp:DataList ID="CustomersList" DataSourceID="CustomerDataSource"
runat="server">
<ItemTemplate>
Name: <asp:Label id="lblName" Text='<%# Eval("Name") %>'
runat="server"/>
</ItemTemplate>
</asp:DataList>
<asp:ObjectDataSource ID="CustomerDataSource" SelectMethod="GetCustomers"
TypeName="Customers" runat="server" />

and code-behind:

public class Customers
{
public List<CustomerGetCustomers()
{
Customer test = new Customer();
test.Name = "Uakari Mabuto";
List<Customerlist = new List<Customer>();
list.Add(test);
return list;
}
}
public class Customer {...}

Why the GetCustomers() method is called twice when the page launches. Then
on subsequent postbacks, it is called only once. I would like the method to
be called once in all cases.

Thanks,
Leszek
Aug 17 '07 #1
0 1824

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

Similar topics

1
by: misiek | last post by:
Hi all. I have a problem with setting value of some parameter in select command in ObjectDataSource. This is what I did: 1. I created DataSet in designer using some stored procedure, which...
9
by: J055 | last post by:
Hi I'm trying to get an instance of UserLists to persist after it's been used by the GridView. I understand from the documentation that The OnObjectCreated event allows access to the instance. I...
1
by: tparks69 | last post by:
I get the error: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Insert' that has parameters: last_name, first_name, email, role_id, user_id, modified_by, modified_date...
0
by: David | last post by:
I have a wizard with various ASP Controls (TextBox/ Dropdown etc...) on the Wizard. The last Step before user clicks the finish button displays a DetailsView listing all the values that the user...
4
by: chris.c.woodward | last post by:
This event seems to be being raised twice in my codebehind. I have only one SelectMethod and do not have a SelectCountMethod. Its causing a problem because I'm dynamically loading a user control...
4
by: TarTar | last post by:
Hello, I have already posted this problem, but I have not received any response yet. I will try to describe it again. We have a list control (e.g. DataList) and an ObjectDataSource on an...
9
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find...
1
by: Max2006 | last post by:
Hi, I am truing to find a pattern for my Business Logic Layer to be able to work fine win ObjectDataSource's Update method. The challenge is ObjectDataSource is not able to work with an...
2
by: rbrowning1958 | last post by:
Hello, Have an objectdatasource with a method much like this: public SomeDataSet.MyDataTable getMyDataTable(int? pkID) { if (pkID == null) return adapater.GetMyTable("ALL") else return...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.