T
TarTar
Hello,
I have the following code on my ASP.NET page:
<asp
ataList ID="CustomersList" DataSourceID="CustomerDataSource"
runat="server">
<ItemTemplate>
Name: <asp:Label id="lblName" Text='<%# Eval("Name") %>'
runat="server"/>
</ItemTemplate>
</asp
ataList>
<asp:ObjectDataSource ID="CustomerDataSource" SelectMethod="GetCustomers"
TypeName="Customers" runat="server" />
and code-behind:
public class Customers
{
public List<Customer> GetCustomers()
{
Customer test = new Customer();
test.Name = "Uakari Mabuto";
List<Customer> list = 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
I have the following code on my ASP.NET page:
<asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
runat="server">
<ItemTemplate>
Name: <asp:Label id="lblName" Text='<%# Eval("Name") %>'
runat="server"/>
</ItemTemplate>
</asp
![Big Grin :D :D](/styles/default/custom/smilies/grin.gif)
<asp:ObjectDataSource ID="CustomerDataSource" SelectMethod="GetCustomers"
TypeName="Customers" runat="server" />
and code-behind:
public class Customers
{
public List<Customer> GetCustomers()
{
Customer test = new Customer();
test.Name = "Uakari Mabuto";
List<Customer> list = 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