Hello Everyone,
I have list items inside objproductBL object.
- List objproductBL = new List();
- objproductBL = objProductDAL.GetProductSpecificaton(productid).Select(item => new ProductItemsBL
- {
- ProductCategoryName = item.ProductCategoryName,
- ProductName = item.ProductName,
- AttributeName = item.AttributeName,
- ProductImage1 = item.ProductImage1,
- ValidValues = item.ValidValues,
- ProductDescription = item.ProductDescription,
- AttributeMaxLength = item.AttributeMaxLength,
- AttributeControlType = item.AttributeControlType
- }).ToList();
From the list, if the 'AttributeControlType' contain "DropDownList" then I want to show it's 'ValidValues' inside drowpdownlist.
For this, I have tried created a string[] inside model class.
- public class Mymodel
- {
- public string[] arryvalidvalue = new string[] { };
- }
Then, implement code like this
- List objproductBL = new List();
- objproductBL = objProductDAL.GetProductSpecificaton(productid).Select(item => new ProductItemsBL
- {
- ProductCategoryName = item.ProductCategoryName,
- ProductName = item.ProductName,
- AttributeName = item.AttributeName,
- ProductImage1 = item.ProductImage1,
- ValidValues = item.ValidValues,
- ProductDescription = item.ProductDescription,
- AttributeMaxLength = item.AttributeMaxLength,
- AttributeControlType = item.AttributeControlType
- }).ToList();
-
- ProductItemsBL objBL = new ProductItemsBL();
-
- bool yesno = false;
- foreach (var item in objproductBL)
- {
- for (int i = 0; i < item.ValidValues.Length; i++)
- {
- if (item.ValidValues.Substring(i, 1) == ",") yesno = true;
- }
- if (yesno == true)
- {
- objBL.arryvalidvalue = (item.ValidValues.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries));
- yesno = false;
- }
- }
-
-
- return objproductBL;
But inside 'return
objproductBL' getting null 'arryvalidvalue' object. How can I get value?
Please help me...