0
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..

Edited by __avd: Added [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by sniigg
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.