- ES Version: 2007 - Trial version
-DB: MSSQL 2005 Express
Here is what I want to accomplish:
- A page will display 3 DetailsView Controls bound to the same
ESDataSource. These DetailsView Controls get their data from the same table.
They are separated to facilitate formatting and printing. – Done and working
fine.
- Custom Paging – The 3 Controls must show the same record. –
Done and working fine.
- Next” and “Back” buttons allow navigation. Gridview1.DataItemIndex
is used to accomplish that.
Code:
// Code for the Next button:
DetailsView1.PageIndex = DetailsView1.DataItemIndex + 1;
- Each Individual DetailsView Control should have editing
capability. – Done and working fine.
- Accomplished through EsDataSource.
- User should be able to type a record ID in a text box, click
“find” and DetailView Controls should display the selected data. Here is where
I need help…

- I believe this is not possible through DetailsView: The
properties SelectedValue, DataItem, DataKey and Page are read only.
- Here is my question: Can I accomplish this using the ES
Collection? I have tried using collection.Filter and collection.Query methods.
They will bring up the correct record, but they will mess with my customized
paging.
Code:
1 // Code in ES_Select
2
3 CustCustomersCollection CustColl = new CustCustomersCollection();
4
5 // CustomerID value comes from Textbox and is added to EsDataSource state through "Find Button"
6
7 if (EsDataSource1.State.ContainsKey("CustomerID"))
8 {
9
10 CustColl.Filter = "CustomerID=" +(int)EsDataSource1.State["CustomerID"];
11
12 // Tried Query.Where, search works fine, but messes with custom paging
13
14 // CustColl.Query.Where(CustColl.Query.CustomerID == (int)EsDataSource1.State["CustomerID"]);
15
16 CustColl.Query.Load();
17 e.Collection = CustColl;
18 EsDataSource1.State.Clear();
19
20 }
21
22 else
23 {
24 CustColl.Query.Load();
25 e.Collection = CustColl;
26
27 }
I’m thinking that
if I can get the Index of an entity within a collection I could pass that index
to the DetailsView1.DataItemIndex property and solve my problem. Is it possible
to pass a parameter to the Collection (Say, record ID=10 and get the Index of
that record within the collection?)
I’m open to suggestions if you think there is a better
way to accomplish this. Thanks and your help is appreciated.
It is all about the Code...