Sambasiva
Sambasiva

Reputation: 1044

DataTable Retrieves another DataTable Information?

I Have an Exception in my Live Application..DataTable Retrives another DataTable information..

if (HttpContext.Current.User != null)
{

    if (Session["username"] != null)
    {
        string pageName = Page.Page.AppRelativeVirtualPath.Substring(Page.Page.AppRelativeVirtualPath.LastIndexOf('/') + 1);
        DataTable dtFeatures2 = new DataTable();
        dtFeatures2.Clear();                                    
        objMatermenuPL.usertype = Session["UserType"].ToString();
        dtFeatures2 = objMastermenuBAL.GetMastermenu(objMatermenuPL);

        DataView dt = new DataView(dtFeatures2);
        dt.Sort = "fld_feature ASC"; 
        if (dtFeatures2 != null)
        {
            foreach (Control control in leftpanel.Controls)
            {
                Type ty = control.GetType();
                if (ty.Name.ToUpper() == "HTMLANCHOR")
                {
                    int i = dt.Find(control.ID.Substring(3));
                    if (i < 0 && control.ID.Contains("lnk"))
                        control.Visible = false;
                    if (control.ID.Contains("lnk") && control.ID.Substring(3) + ".aspx" == pageName)
                    {
                        HtmlAnchor a = (HtmlAnchor)control;
                        a.Attributes.Add("class", "active");
                    }
                }
            }
        }



            }
        }
        else
        {
            Response.Redirect("~/Login.aspx");
        }

This code we use All most all master pages...If an exception Raise,then it comes directly this line..

 dtFeatures2 = objMastermenuBAL.GetMastermenu(objMatermenuPL);

Message like : Cannot find column fld_feature.

"dtFeatures2" is Filled With Before Opened Page DataTable Information...

This exception gone after some..It's Working Fine 100%....Some times only shows these exception...What happend Here........

Upvotes: 1

Views: 69

Answers (0)

Related Questions