protected void Page_Load(object sender, EventArgs e) { if (this.Session["UserName"] == null) { Response.Redirect("~/login.aspx"); } if (!sec.UserRight("2544", "001")) { Response.Redirect("~/Test.aspx"); } if (Page.IsPostBack) { if (!string.IsNullOrEmpty(Session["LookUpData"].ToString())) { SelectedPartDetail(Session["LookUpData"].ToString()); } } if (IsPostBack == false) { if (Session["TransCode"] != null) { txtPayInvDate.Text = DateTime.Now.ToString("dd-MM-yyyy"); ObjMain.FillDropDown(ddlVendor, "select VendorCode,VendorDesc from Vendor Where DealerCode in('" + Session["DealerCode"].ToString() + "','COMON')", "VendorDesc", "VendorCode", "Select"); createPartsDT(); Load_ddlPurInvNo(); string leadId = Session["TransCode"].ToString(); ddlPayInvNo.SelectedValue = leadId; ddlPayInvNo_SelectedIndexChanged(null, null); } else { lblMode.Text = "Add Mode"; txtPayInvDate.Text = DateTime.Now.ToString("dd-MM-yyyy"); ObjMain.FillDropDown(ddlVendor, "select VendorCode,VendorDesc from Vendor Where DealerCode in('" + Session["DealerCode"].ToString() + "','COMON')", "VendorDesc", "VendorCode", "Select"); createPartsDT(); Load_ddlPurInvNo(); } } Session["TransCode"] = null; Session["LookUpData"] = string.Empty; }