strange text appearing in gridview dropdownlist

J

Jon Paal

this text keeps showing up in my gridview dropdownlist

"System.Data.DataRowView"

How do I prevent this problem ?
 
K

Kevin Goff

Can you post the code you use for databinding? You are probably missing
something there.
 
J

Jon Paal

....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>
 
J

Jon Paal

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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top