protected void Page_Load(object sender, EventArgs e) { AuthenticateUser(); intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCustomized = new Customized(intProfile, dsn); oPage = new Pages(intProfile, dsn); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intId = Int32.Parse(Request.QueryString["id"]); } if (!IsPostBack) { drpCategory.DataSource = oCustomized.GetCategories(0); drpCategory.DataTextField = "name"; drpCategory.DataValueField = "id"; drpCategory.DataBind(); drpCategory.Items.Insert(0, new ListItem("--SELECT--")); drpItem.DataSource = oCustomized.GetItems(0); drpItem.DataTextField = "name"; drpItem.DataValueField = "id"; drpItem.DataBind(); drpItem.Items.Insert(0, new ListItem("--SELECT--")); rptView.DataSource = oCustomized.GetCategoryList(intId); rptView.DataBind(); } foreach (RepeaterItem ri in rptView.Items) { LinkButton oEdit = (LinkButton)ri.FindControl("btnEdit"); Panel panEdit = (Panel)ri.FindControl("panEdit"); panEdit.Visible = true; LinkButton oDelete = (LinkButton)ri.FindControl("btnDelete"); oDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item ?');"); } lblNone.Visible = rptView.Items.Count == 0; drpItem.Attributes.Add("onchange", "AjaxGetItemAmount('" + drpItem.ClientID + "','" + lblAmt.ClientID + "','');"); btnAdd.Attributes.Add("onclick", "return ValidateDropDown('" + drpCategory.ClientID + "','Please select a category')" + " && ValidateDropDown('" + drpItem.ClientID + "','Please select an item')" + ";"); //btnUpdate.Attributes.Add("onclick", "return ValidateDropDown('" + drpCategory.ClientID + "','Please select a category')" + // " && ValidateDropDown('" + drpItem.ClientID + "','Please select an item')" + // ";"); }
protected void Page_Load(object sender, EventArgs e) { intProfile = Int32.Parse(Request.Cookies["profileid"].Value); oCustomized = new Customized(intProfile, dsn); oPage = new Pages(intProfile, dsn); oUser = new Users(intProfile, dsn); if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "") { intPage = Int32.Parse(Request.QueryString["pageid"]); } if (Request.QueryString["id"] != null && Request.QueryString["id"] != "") { intId = Int32.Parse(Request.QueryString["id"]); } if (intId > 0) { DataSet ds = oCustomized.GetCostAvoidanceById(intId); if (ds.Tables[0].Rows.Count > 0) { lblTitle.Text = "View Cost Avoidance"; lblCAO.Text = ds.Tables[0].Rows[0]["opportunity"].ToString(); lblDescription.Text = ds.Tables[0].Rows[0]["description"].ToString(); if (ds.Tables[0].Rows[0]["path"].ToString() != "") { hypUpload.NavigateUrl = ds.Tables[0].Rows[0]["path"].ToString(); } else { hypUpload.Text = ""; } string strVal = ds.Tables[0].Rows[0]["addtlcostavoidance"].ToString(); strVal = strVal == "" ? "0" : strVal; lblAddtlCA.Text = String.Format("{0:C}", Double.Parse(strVal)); lblDate.Text = DateTime.Parse(ds.Tables[0].Rows[0]["date"].ToString()).ToShortDateString(); lblSubmitter.Text = oUser.GetFullName(Int32.Parse(ds.Tables[0].Rows[0]["userid"].ToString())); lblDateSubmit.Text = DateTime.Parse(ds.Tables[0].Rows[0]["created"].ToString()).ToShortDateString(); rptView.DataSource = oCustomized.GetCategoryList(intId); rptView.DataBind(); lblNone.Visible = rptView.Items.Count == 0; } } }