strange text appearing in gridview dropdownlist

  • Thread starter Thread starter Jon Paal
  • Start date Start date
J

Jon Paal

this text keeps showing up in my gridview dropdownlist

"System.Data.DataRowView"

How do I prevent this problem ?
 
Can you post the code you use for databinding? You are probably missing
something there.
 
....asp:SqlDataSource
SelectCommand="SELECT userid, status FROM aspnet_Users, UserData WHERE userid = userdataid AND Len(userid ) > 2 "
UpdateCommand="UPDATE UserData SET status = @status WHERE userid = @userid ">
<UpdateParameters>
<asp:Parameter Name="userid " Type="String" />
</UpdateParameters>

....asp:GridView
DataKeyNames="userid"

....
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:Label id="label1" runat="server" Text='<%# Eval("Status") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList runat="server" ID="ddlStatus"
AppendDataBoundItems="true"
SelectedValue='<%# Bind("status") %>'
DataSourceID= "SqlDataSource1"
AutoPostBack="False" >
<asp:ListItem Text="Open" Value="Open"></asp:ListItem>
<asp:ListItem Text="Closed" Value="Closed"></asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
 
The list of options is not drawn from the database. The list is a fixed set of choices and the selected value is matched to that
retrieved from the database.

I'm getting the correct outcome and everything works as expected except there are those strange items added to my fixed list of
options in the DDL. I have no idea what is causing them to appear....
 
Back
Top