private void LoopRepeater() { DataSet ds = oCustomized.GetCategories(0); DataView dv = ds.Tables[0].DefaultView; if (Request.QueryString["sort"] != null) { dv.Sort = Request.QueryString["sort"].ToString(); } rptView.DataSource = dv; rptView.DataBind(); foreach (RepeaterItem ri in rptView.Items) { ImageButton oDelete = (ImageButton)ri.FindControl("btnDelete"); oDelete.Attributes.Add("onClick", "return confirm('Are you sure you want to delete this item?');"); ImageButton oEnable = (ImageButton)ri.FindControl("btnEnable"); if (oEnable.ImageUrl == "images/enabled.gif") { oEnable.ToolTip = "Click to disable"; oEnable.Attributes.Add("onClick", "return confirm('Are you sure you want to disable this item?');"); } else { oEnable.ToolTip = "Click to enable"; } } }
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')" + // ";"); }