Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
4.33/5 (2 votes)
Hi, i have samo DataSet in "ds" column of another dataset.
C#
for(int i...)
{
    DataSet data=....
    ds.Tables[0].Rows[i]["Datas"] = data;
}

cList.DataSource = ds;
cList.DataBind();

In aspx file i have repeater and DropDownList (fill dropdownlist with dataset which is in other dataset)
ASP.NET
<asp:Repeater ID="cList" runat="server">
<asp:DropDownList runat="server" ID="selectFProd" DataSource="<%# Eval("Datas") %>" DataTextField="Col1" DataValueField="Col2ID"></asp:DropDownList>
</asp:Repeater>

When i run my asp.net application, i get this error
Parser Error Message: The server tag is not well formed.

for line, where is the DropDownList. What im doing wrong? Thanks
Posted
Comments
Thanks7872 3-Jun-14 14:05pm    
Search google using "Repeater in ASP.NET". Open whatever link you like and see the code there. Compare it with yours. You will find where the problem is.
vezo11 3-Jun-14 14:15pm    
Do you think header, item and footer template? I have them.

Use backslash before double quotes and it will work properly:
C#
<asp:DropDownList runat="server" ID="selectFProd" DataSource="<%# Eval(\"Datas\") %>" 
 
Share this answer
 
v2
Comments
vezo11 3-Jun-14 15:55pm    
I tried but it didnt work (i know what you mean with this), thanks
 
Share this answer
 
Comments
vezo11 3-Jun-14 16:05pm    
Thanks! :) At bottom i will add my soluton
vezo11 9-Jun-14 7:47am    
On my solution i add one column for the selection text. Do you have any idea how i can add one more column for the index (id from database of C_ID in my solution)? Thanks
I traied but it didnt work, thanks

My solution is:
file.aspx
ASP.NET
<asp:dropdownlist runat="server" id="sFP" datasource="<%# fillDataList((string)DataBinder.Eval(Container.DataItem, "C_ID")) %>" datatextfield="Title" xmlns:asp="#unknown"></asp:dropdownlist>

file.aspx.cs
C#
public DataView fillDataList(string id)
{
    DataSet data = DB.GetData("SELECT * FROM … WHERE FK =" + id + ")", false);

    DataView myView = data.Tables[0].DefaultView;

    return myView;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900