如何将视图中的数据绑定到带有C#代码的下拉列表中 [英] How I Can Bind A Data From Views Into A Dropdownlist With C# Code
本文介绍了如何将视图中的数据绑定到带有C#代码的下拉列表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
i want know
how i can bind Views into a dropdownlist with C# code.
Here is my code:
mobjGenlib = new clsGeneralLib();
mobjGenlib.Bindcolumn(DDLSearchField, "VW_MasterAsset", "mASS");
推荐答案
我找到了解决方案
这是方式
mobjGenlib.Bindcolumn(DDLSearchField,VW_MasterAsset,mASS);
和
I found the solution
Here is the way
mobjGenlib.Bindcolumn(DDLSearchField, "VW_MasterAsset", "mASS");
and
if (Table.ToUpper() == "VW_MASTERASSET")
{
Model = new AttributeMappingSource().GetModel(typeof(LQMasterDataContext));
}
foreach (var TableName in Model.GetTables())
{
if (TableName.RowType.ToString().ToUpper() == Table.ToUpper())
{
foreach (var ColumnName in TableName.RowType.DataMembers)
{
string var = ColumnName.MappedName;
if (var.IndexOf(Label, 0) < 0)
{
string ColName = ColumnName.MappedName.Replace("[", "");
ColName = ColName.Replace("]", "");
DDLCur.Items.Add(ColName);
}
}
}
}
这篇关于如何将视图中的数据绑定到带有C#代码的下拉列表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文