Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't get a dropdown IitemTemplate) to bind
Message
From
06/10/2006 10:48:10
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Can't get a dropdown IitemTemplate) to bind
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01160047
Message ID:
01160047
Views:
52
This must be a simple one but I can't get it done properly.

I generally do most everything in code-behind page. Decided on a new web project I'll use the VS2005 page designer for a Gridview.

This Admin page displays a list of every employee's name and a dropdown to select one of four possible access levels.
The relevant portion of the gridview is:
<asp:GridView ID="grdEmployees" runat="server" 
   AutoGenerateColumns="False"
   //lots of grid style stuff here
   DataSourceID="dsEmployees" 
   AllowPaging="True" PageSize="20">

   <Columns>
      <asp:BoundField DataField="displayname" HeaderText="Name" />
      <asp:TemplateField HeaderText="Access Level">
         <ItemTemplate>
            <asp:DropDownList ID="cboAccess" runat="server"  
               SelectedValue='<%# Eval("access_level") %>'>
            </asp:DropDownList>
         </ItemTemplate>
      </asp:TemplateField>
   </Columns>
</asp:GridView>

<asp:ObjectDataSource ID="dsEmployees" runat="server" 
   SelectMethod="getAllEmployees"
   TypeName="servd.DataAccessLayer" />
The data as you see comes from a Data Access Layer (3-Tier). The problem I'm having is that I can't bind the dropdown.
The query does a join from all employees table, with table of users allowed in this app and table of access levels (Admin, Regular user, etc.)

The error I get is in Eval("access_level"):
'cboAccess' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
Evidently it does not see the colunn named "access_level" in the DataSet.

I'm sure I'm missing something simple. Any clues?
TIA


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Next
Reply
Map
View

Click here to load this message in the networking platform