foreach (string id in str1)
                                {
                                    string logoImage = "";
                                    string BundleID = id;
                                    BundleSearchResultStruct BundleSearchResult = nbsi.GetProductDetails(guid, "marketingPartnerPassword", Convert.ToInt32(BundleID));
                                                          
                                    string y = builder1.Append(BundleSearchResult).Append(",").ToString();
                                    y = y.TrimEnd(',');
                                    Session["BundleSearchResult"] = y;
                               //some code relevent only to this block
                                     }


while (reader1.Read())
                                    {

//do something



 foreach (string id in str1)
                                        {
                                            string logoImage = "";
                                            string BundleID = id;
                                            //BundleSearchResultStruct bsr2 = nbsi.GetProductDetails(guid, "marketingPartnerPassword", Convert.ToInt32(BundleID));
                                           
                                            
                                            string bsr = Session["BundleSearchResult"].ToString();
                                            string[] bsr1 = bsr.Split(',');

                                            foreach (string bsr2 in bsr1)
                                            {
                                                
                                                 
                                                System.Web.UI.HtmlControls.HtmlGenericControl dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                                                li.Controls.Add(dynDiv);
                                                Type type = bsr2.GetType();
                                                PropertyInfo senderproperty = type.GetProperty(reader1["XmlName"].ToString());

                                                object PropertyValue = senderproperty.GetValue(bsr2, null);

                                                string Nodetype = reader1["Type"].ToString();
                                                string XmlName = reader1["XmlName"].ToString();

                                                dynDiv.Attributes.Add("class", "block1");

                                                if (Nodetype == "Pound")
                                                {

                                                    if (Convert.ToDecimal(PropertyValue.ToString()) > 0)
                                                    {

                                                        dynDiv.InnerText = String.Format("{0:C}", PropertyValue.ToString());
                                                    }

                                                    else
                                                    {

                                                        dynDiv.InnerText = "Free";
                                                    }

                                                }
}

here in my application in the first
BundleSearchResult = nbsi.GetProductDetails(guid, "marketingPartnerPassword", Convert.ToInt32(BundleID));
i am calling an API....i need to use the object in BundleSearchResult in the second foreach (string id in str1)...so i have used the session to get the objects..

but the prob is at Type type = bsr2.GetType(); the type should be the class but i am getting as string..so what to do..

sniigg,

Please read the rules before posting again, in particular the 'keep it organized' one - subject titles such as 'help urgent' are not allowed. If you hit 10 infraction points your account gets an automatic ban, so it is worth obeying the rules if you want to continue to benefit from DaniWeb help.

Hi,

Sorry about that, would not repeat it...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.