The ViewData item that has the key 'txtCustomer' is of type 'System.String' but must be of type 'IEnumerable'
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
item = new List (); - 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 ";
- }
- }

Nilesh PatilRank #1,129 · 1.6K reputationPosted Nov 19, 2017, 6:11 PM EST
Bryan Gomez19 reputationPosted Nov 19, 2017, 6:23 PM EST
Asma KhalidRank #160 · 14.7K reputationPosted Nov 19, 2017, 6:25 PM EST
Nilesh PatilRank #1,129 · 1.6K reputationPosted Nov 19, 2017, 6:31 PM EST
Asma KhalidRank #160 · 14.7K reputationPosted Nov 19, 2017, 7:02 PM EST