TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Bryan Gomez
NA
21
37k
How set value of DropDown after getting the list
Nov 19 2017 10:57 PM
I need to set value of the dropdown after getting the list for dataset. But I'm having an error of:
The ViewData item that has the key 'txtCustomer' is of type 'System.String' but must be of type 'IEnumerable<SelectListItem>'
Here's my Controller:
wmsSR =
new
WMSSOFT_WCF_Service.WMSSOFT_InterfaceClient();
dsl =
new
DataSet();
dsO =
new
DataSet();
a =
"GetSRMCustomers"
;
b =
string
.Empty;
//b = wmsSR.fCallWMSSOFTService(a, null, ref dsl, ref dsO);
b = wmsSR.fCallWMSSOFTService(a,
""
,
ref
dsl,
ref
dsO);
if
(b ==
"OK ~~"
)
{
if
(dsO.Tables[0].Rows.Count >= 0)
{
List<SelectListItem> item =
new
List<SelectListItem>();
for
(
int
i = 0; i < dsO.Tables[0].Rows.Count; i++)
{
item.Add(
new
SelectListItem { Text = dsO.Tables[0].Rows[i][
"NAMECUST"
].ToString(), Value = dsO.Tables[0].Rows[i][
"IDCUST"
].ToString().Replace(
" "
, String.Empty) });
}
ViewBag.txtCustomer = item;
ViewBag.txtCustomer = "ABC ";
}
}
Reply
Answers (
5
)
DataTable in .Net Core looks plain
Service Unavailable HTTP Error 503.