I have 2 datalists and a datagrid on one page.  I am using 
databinder.eval to retrieve the necessary values when the controls 
are bound to the database.  Each of the controls requires a separate 
stored procedure to retrieve the correct data for the control - I am 
unable to combine them into a single stored procedure.  The problem 
I am running into is that if for instance the first control displays 
name and total hours and the second control displays activity and 
hours - it causes an error on the first control because after 
evaluating the second control it will say that "name" does not exist 
in the dataview - which is being caused because it is rebinding the 
first datalist when it binds for the second datalist control.  How 
do I get each control to only bind for the data they are targeted 
for?

Here is the code for my 2 datalists - there is also a datagrid which 
I did not include:
<P><asp:label id="lblDtList" runat="server" Font-
Bold="True"></asp:label></P>
<asp:datalist id="dlstUserHours" runat="server" Width="752px"  
RepeatColumns="2">
<ItemStyle HorizontalAlign="Left" Width="450px"></ItemStyle>
<ItemTemplate>
<TABLE height="25">
<TR>
<TD width="20%"></TD>
<TD width="50%"><%# Databinder.Eval(Container,"DataItem.Name") ></TD>
<TD width="10%">&nbsp;&nbsp;&nbsp;<%# Databinder.Eval
(Container,"DataItem.SuppAct_Hours") %></TD>
<TD width="20%"></TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:datalist></TD>
<TD height="115"></TD>
</TR>
<tr>
<TD vAlign="top" width="70%" height="115">
<P><asp:label id="lblDtListActivity" runat="server" Font-
Bold="True"></asp:label></P>
<asp:datalist id="dlstActivity" runat="server" Width="752px">
<ItemStyle HorizontalAlign="Left" Width="450px"></ItemStyle>
<ItemTemplate>
<TABLE height="25">
<TR>
<TD width="20%"></TD>
<TD width="50%"><%# 
Databinder.EvalContainer,"DataItem.ActivityName") %></TD>
<TD width="10%">&nbsp;&nbsp;&nbsp;<%# Databinder.Eval
(Container,"DataItem.suppAct_hours") %></TD>
<TD width="20%"></TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:datalist></TD>
<TD height="115"></TD>
</tr>
<TR>

Here is the corresponding databinding routines:
Sub Getdldata()
        'Dim locID As Integer = Request.QueryString("LID")
        'Dim iloc As Integer = Convert.ToInt32(locID)
        Try
            Dim dtUserHours = DataHelper.GetUserHours()
            Dim dvw_userHours = New DataView(dtUserHours)
            dvw_userHours.RowFilter = "LocationID=" & locID & " and 
per_inactiveID =0"
            Dim r As DataRowView
            BindDlst(dvw_userHours)
        Catch ex As Exception
            Throw New Exception("Get User hours failed", ex)
        End Try

    End Sub

    Sub GetdlActivitydata()
        Try
            Dim dtLocActivity = DataHelper.GetAllActivitiesAndUsers
            Dim dvw_LocActivity = New DataView(dtLocActivity)
            dvw_LocActivity.RowFilter = "Act_SubCategoryID = 24"
            BindActivityDlst(dvw_LocActivity)
        Catch ex As Exception
            Throw New Exception("Get People Activity List failed", 
ex)
        End Try

    End Sub





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to