protected void GridDpt_RowCommand(object sender, GridCommandEventArgs e) { int roleID = GetSelectedDataKeyID(GridDpt); if (e.CommandName == "Delete") { BLL.tLink BLL = new Maticsoft.BLL.tLink(); bool isTrue = BLL.Delete(roleID); if (!isTrue) { Alert.ShowInTop("删除失败!"); return; } else { LoadData(); } } else { Window1.Title = "编辑链接"; string openUrl = String.Format("./LinkEdit.aspx?roleId={0}", HttpUtility.UrlEncode(roleID.ToString())); PageContext.RegisterStartupScript(Window1.GetSaveStateReference(roleID.ToString()) + Window1.GetShowReference(openUrl)); } }
public string GetLink(int tid, int top) { Maticsoft.BLL.tLink BLL = new Maticsoft.BLL.tLink(); DataTable dt = BLL.GetListByPage(" TyID=" + tid, " id desc,Sort desc ", 0, top).Tables[0]; StringBuilder sb = new StringBuilder(); for (int i = 0; i < dt.Rows.Count; i++) { sb.Append(" <a href='" + dt.Rows[i]["Url"] + "' target='_blank' title='" + dt.Rows[i]["Name"] + "' > " + dt.Rows[i]["Name"] + "</a> "); } return(sb.ToString()); }
protected void LoadData() { Maticsoft.BLL.tLink BLL = new Maticsoft.BLL.tLink(); string sortField = GridDpt.SortField; string sortDirection = GridDpt.SortDirection; GridDpt.RecordCount = BLL.GetRecordCount(""); DataView view = BLL.GetListByPage("", "", GridDpt.PageIndex * GridDpt.PageSize, (GridDpt.PageIndex + 1) * GridDpt.PageSize).Tables[0].DefaultView; view.Sort = String.Format("{0} {1}", sortField, sortDirection); GridDpt.DataSource = view.ToTable(); GridDpt.DataBind(); }