protected void Page_Load(object sender, EventArgs e) { if (!Context.User.IsInRole("Store Manager")) { Response.Redirect("~/ErrorPages/Unauthorised"); } else { if (!IsPostBack) { // Directed from "View" in list if (Request.QueryString["code"] != null) { // Get supplier string code = Request.QueryString["code"]; ViewState["code"] = code; Supplier s = suLogic.FindSupplierById(code); // Validate if supplier exists if (s != null) { // Header lblName.Text = s.SupplierName; lblCode.Text = s.SupplierCode; lblGST.Text = s.GSTRegistrationNo; lblAddress.Text = s.Address; lblContactPerson.Text = s.ContactName; lblPhone.Text = s.Phone; lblFax.Text = s.Fax; // Items List <SupplierStationery> listItems = suLogic.FindStationeryDetailOfSupplier(code); gvItems.DataSource = listItems; gvItems.DataBind(); lblTotal.Text = listItems.Count.ToString(); } else { PanelMessage.Visible = true; } } else { PanelMessage.Visible = true; } } } }