数据集中的DataSet问题与设置DataSource有关 [英] DataSet in Dataset problem with set DataSource

查看:161
本文介绍了数据集中的DataSet问题与设置DataSource有关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在另一个数据集的ds列中有samo DataSet。

Hi, i have samo DataSet in "ds" column of another dataset.

for(int i...)
{
    DataSet data=....
    ds.Tables[0].Rows[i]["Datas"] = data;
}

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



在aspx文件中我有转发器和DropDownList(填充下拉列表,数据集在其他数据集中)


In aspx file i have repeater and DropDownList (fill dropdownlist with dataset which is in other dataset)

<asp:Repeater ID="cList" runat="server">
<asp:DropDownList runat="server" ID="selectFProd" DataSource="<%# Eval("Datas") %>" DataTextField="Col1" DataValueField="Col2ID"></asp:DropDownList>
</asp:Repeater>



当我运行我的asp.net应用程序时,我得到了这个错误


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 is DropDownList。我做错了什么?谢谢


for line, where is the DropDownList. What im doing wrong? Thanks

推荐答案

在双引号之前使用反斜杠它会正常工作:

Use backslash before double quotes and it will work properly:
<asp:DropDownList runat="server" ID="selectFProd" DataSource="<%# Eval(\"Datas\") %>" 


看到这个.. :)



Repeater中的DropDownList [ ^ ]



如何从Repeater内部绑定DropDownList? [ ^ ]



分辨-DATA-压圈的DropDownList-内部-A-中继器控逆变 [<一个href =http://www.vbforums.com/showthread.php?656753-RESOLVED ASSO-bind-DropDownList-inside-a-repeater-contoltarget =_ blanktitle =New Window> ^ ]
see this.. :)

DropDownList in Repeater[^]

How to bind a DropDownList from inside a Repeater ?[^]

RESOLVED-Data-bind-DropDownList-inside-a-repeater-contol[^]


我发了但是它没有用,谢谢



我的解决方案是:

file.aspx

I traied but it didnt work, thanks

My solution is:
file.aspx
<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


file.aspx.cs

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

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

    return myView;
}


这篇关于数据集中的DataSet问题与设置DataSource有关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆