views:

417

answers:

1

I'm working on a project which will pull data from two different tables, Events and Travel Times. I'm displaying it in a DataList using ItemTemplate. Almost all of the information displayed in the DataList will be from Events and will always be displayed. The data from Travel Times will only be shown if it falls within a certain range of a value, 'ID', in Events. The 'ID' value is not always populated.

Is there a good way to go about doing this? I thought about having a label inside the ItemTemplate, set it's value, and then have a 'ValueChanged' event trigger. Inside that event, I could check if 'ID' falls within a range and run a query and set the table to the Travel Time result if it did. I thought. Tried getting it to work and no luck declaring the event for the label.

Thanks for any help you can provide. I'm honestly pretty lost with what I'm working with, so any suggestions or info about ASP.NET in general is appreciated.

Edit: Someone requested some code, it's all on paper thus far but here's the basic gist of what I have planned.

SELECT [IncdntDate], [Roadway], CrossRoad]....[RdwyID] FROM [Events]

The RdwyID there is what I have to tell me to post the travel times, say, between 230 and 250. It doesn't always have a value in it though.

<asp:DataList ID="DataList1" runat="server" DataSourceID="TravelComm">
      <ItemTemplate>
          <asp:Label ID="FromLabel" runat="server" Font-Size="Small" 
           Text='<%# Eval("Roadway") %>'></asp:Label><br />
            ....
      </ItemTemplate>
</asp:DataList>

I'd just output all the returned entries just like that, basically. A lot of the information I'm returning doesn't have any travel times though, and I'm basically trying to figure out how to have it say "Travel Time: Unknown", or left blank, if it has no time and the valid Travel Time if it matches the RdwyID condition.

Edit 2: If the core idea is fine, and all I have right now is basically on paper, then I need to put more time into it and come back when I have something concrete to show. Thanks for the help!

A: 

Your idea is fine, but obviously you are doing something wrong (because it's not working).

Please, post some code so we can help you more.

eKek0