[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 560
  • Last Modified:

About itemdatabound

Dears!
i have this repeater in my page

<asp:repeater id="Repeater1" runat="server" OnItemCommand="Repeater1_ItemCommand">
<HeaderTemplate>
    <table width="100%" class="table">
</HeaderTemplate>
<ItemTemplate>
    <tr>
    <td width="10%" bgcolor="Beige">
    <asp:Label id="lbhora" Runat="server">
    <%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "StartTime")).ToShortTimeString() %>
    </asp:Label>
    </td>
    <td bgcolor="LemonChiffon">
    <asp:LinkButton id="Linkbutton3" runat="Server" CssClass="aa" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"Href") %>' CommandName="Select">
    <%# DataBinder.Eval(Container.DataItem, "Task") %>
    </asp:LinkButton><br>
    </td>
    </tr>
</ItemTemplate>
    <FooterTemplate>
    </TABLE>
    </FooterTemplate>
    </asp:repeater>

as you could see im trying to build a daily schedule. this is working fine.
But. i want to have two events in the same time, together. as this:

10:30  event 1 - event 2 - event 3 (or something like that!)

how can i save the last time binded?
any ideas?

ask me if it is not explained enough!
0
FLUXWIRE
Asked:
FLUXWIRE
  • 3
  • 3
1 Solution
 
nouloukCommented:
Well, hi Fluxwire.

You have to create a new repeater inside your main repeater (nestead repeater).
Then, you can add all events you want inside nestead repeater.

Hope this help you.
0
 
FLUXWIREAuthor Commented:
The solution is very nice!
I dont know yet how to implement it.

I have a datatable that i use as datasource for my repeater.
this datatable has two columns. the time and the event.
i will put the second repeater in the table cell where i have the events.
this second repeater i will need to bind with a datatable view where i
select events from the same time?

0
 
nouloukCommented:
You have to rebuild your dataset schema:
datatableTime (scheduleTimeId,datetime,...)
datatableTimeEvents(EventId,scheduleTimeId,eventName,eventDescription...)

Then you set the datasource of your master repeater to datatableTime and for the nestead repeater, you set the datasource in itemdatabound event depends on which item is selected, so which time is selected.

Hope you see how to proceed.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
FLUXWIREAuthor Commented:
Hi!
I got some examples using two tables with relationship between them.
But in this case i have only one table. like this
12:00 event1
12:30 event2
12:30 event3
12:30 event4
15:00 event5
and so on.
how can i use only this table to put the time in the first repeater and the event name in the second?

sorry. i didnt get it yet!
0
 
nouloukCommented:
OK,
you have to create two temporary tables:
the first one will contains the datetime and the second one all events with the relationship like in my previous post.
datatableTime (scheduleTimeId,datetime,...)
datatableTimeEvents(EventId,scheduleTimeId,eventName,eventDescription...)

Programmatically:
DataTable datatableTime=new DataTable();
DataColumn dataColumnscheduleTimeId=new DataColumn();
datatableTime.Columns.Add(dataColumnscheduleTimeId); ...

DataTable datatableTimeEvents=new DataTable();
DataColumn dataColumnEventId=new DataColumn();
DataColumn dataColumnscheduleTimeId=new DataColumn();
datatableTimeEvents.Columns.Add(dataColumnEventId);
datatableTimeEvents.Columns.Add(dataColumnscheduleTimeId); ...

DataSet dataSetTemp=new DataSet();
dataSetTemp.Tables.Add(datatableTime);
dataSetTemp.Tables.Add(datatableTimeEvents);
dataSetTemp.Relations.Add(new Relation()); ... (with VS it's easier to define the relation between those tables)

Now, you have your temporary dataset and tables.
This is a summary of how you can proceed.

Then you set the datasource of your master repeater to datatableTime and for the nestead repeater, you set the datasource in itemdatabound event depends on which item is selected, so which time is selected.
0
 
FLUXWIREAuthor Commented:
ok. i get it!
thx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now