/// <summary> /// 邦定GridView /// </summary> private void BindGridView() { long UserID = NDConvert.ToInt64(Session["UserID"]); //当前管理操作的中 DataSet ds = GetData(UserID.ToString()); DataTable dt = ds.Tables[1]; grid.DataSource = dt; grid.DataBind(); BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString())); for (int i = 0; i < grid.Rows.Count; i++) { long ID = NDConvert.ToInt64(grid.DataKeys[i]["SID"].ToString()); DataTable GetSurveyInfo = new SurveyManage_Layer().GetSurveyTable(ID.ToString(), UserID.ToString()); //编辑 //LinkButton objEdit = (LinkButton)grid.Rows[i].Cells[10].Controls[0]; //System.Web.UI.WebControls.Image image2 = new System.Web.UI.WebControls.Image(); //image2.Style.Add("margin", "0"); //image2.ImageUrl = "images/edit2.gif"; //objEdit.Text = "编辑"; //grid.Rows[i].Cells[10].Controls.AddAt(0, image2); } }
/// <summary> /// 邦定GridView /// </summary> private void BindGridView() { if (Request.QueryString["SID"] != null) { string SID = (Request.QueryString["SID"]).ToString(); long UserID = NDConvert.ToInt64(Session["UserID"]); //当前管理操作的中 DataSet ds = GetData(SID); DataTable dt = ds.Tables[1]; grid.DataSource = dt; grid.DataBind(); BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString())); for (int i = 0; i < grid.Rows.Count; i++) { long ID = NDConvert.ToInt64(grid.DataKeys[i]["SID"].ToString()); DataTable GetSurveyInfo = new SurveyManage_Layer().GetSurveyTable(ID.ToString(), UserID.ToString()); //问卷名称 LinkButton surveyName = (LinkButton)grid.Rows[i].Cells[1].Controls[0]; if (ConvertString(grid.DataKeys[i]["SurveyName"]).Length > 8) { surveyName.Text = ConvertString(grid.DataKeys[i]["SurveyName"]).Substring(0, 7); } else { surveyName.Text = ConvertString(grid.DataKeys[i]["SurveyName"]); } surveyName.ToolTip = ConvertString(grid.DataKeys[i]["SurveyName"]); //答题者 //LinkButton objName = (LinkButton)grid.Rows[i].Cells[2].Controls[0]; //if (grid.DataKeys[i]["AnswerUserKind"] == null || ConvertString(grid.DataKeys[i]["AnswerUserKind"])=="0") //{ grid.Rows[i].Cells[2].Text = ConvertString(grid.DataKeys[i]["UserName"]); //} //else //{ // if (ConvertString(grid.DataKeys[i]["AnswerUserKind"]) == "2") // { // grid.Rows[i].Cells[2].Text = "匿名"; // } // else // { // grid.Rows[i].Cells[2].Text = "后台(" + new AnswerManager_Layer().GetManager(ConvertString(grid.DataKeys[i]["UID"]))+")"; // } //} //审批状态 LinkButton objEdit = (LinkButton)grid.Rows[i].Cells[7].Controls[0]; if (dt.Rows[0]["SPar"].ToString().IndexOf("|NeedConfirm:1") < 0) { grid.Rows[i].Cells[7].Text = "无需审核"; } else if (ConvertString(grid.DataKeys[i]["ApprovalStaus"]) == ConvertString((int)CommonEnum.ApprovalStaus.Pending)) { grid.Rows[i].Cells[7].Text = "待审批"; grid.Rows[i].Cells[7].ForeColor = Color.Red; } else if (this.ConvertString(grid.DataKeys[i]["ApprovalStaus"]) == ConvertString((int)CommonEnum.ApprovalStaus.Pass)) { grid.Rows[i].Cells[7].Text = "已通过"; grid.Rows[i].Cells[7].ForeColor = Color.Green; } //删除 LinkButton objDel = (LinkButton)grid.Rows[i].Cells[8].Controls[0]; objDel.OnClientClick = "if(!window.confirm('确定要删除该数据吗?'))return false;"; System.Web.UI.WebControls.Image image3 = new System.Web.UI.WebControls.Image(); image3.Style.Add("margin", "0"); image3.ImageUrl = "images/del.gif"; objDel.Text = "删除"; grid.Rows[i].Cells[8].Controls.AddAt(0, image3); } } else { } }
/// <summary> /// 邦定GridView /// </summary> private void BindGridView() { long UserID = NDConvert.ToInt64(Session["UserID"]); //当前管理操作的中 if (UserID > 0) { DataSet ds = GetData(UserID.ToString()); DataTable dt = ds.Tables[1]; grid.DataSource = dt; grid.DataBind(); BindviewPage(NDConvert.ToInt32(ds.Tables[0].Rows[0][0].ToString())); for (int i = 0; i < grid.Rows.Count; i++) { long ID = NDConvert.ToInt64(grid.DataKeys[i]["SID"].ToString()); DataTable GetSurveyInfo = new SurveyManage_Layer().GetSurveyTable(ID.ToString(), UserID.ToString()); //问卷名称 LinkButton objName = (LinkButton)grid.Rows[i].Cells[1].Controls[0]; objName.ToolTip = grid.DataKeys[i]["SurveyName"].ToString(); if (grid.DataKeys[i]["SurveyName"].ToString().Length > 7) { objName.Text = grid.DataKeys[i]["SurveyName"].ToString().Substring(0, 6); } else { objName.Text = grid.DataKeys[i]["SurveyName"].ToString(); } if (NDConvert.ToInt32(grid.DataKeys[i]["State"].ToString()) == (int)CommonEnum.SurveyState.NotCreate) { objName.ForeColor = Color.Red; } else { objName.ForeColor = Color.Green; } //回收数 LinkButton objAnswerAmount = (LinkButton)grid.Rows[i].Cells[2].Controls[0]; if (GetSurveyInfo.Rows.Count > 0) { if (long.Parse(GetSurveyInfo.Rows[0]["MaxAnswerAmount"].ToString()) > 0) { objAnswerAmount.Text = GetSurveyInfo.Rows[0]["AnswerAmount"].ToString() + "/" + GetSurveyInfo.Rows[0]["MaxAnswerAmount"].ToString(); } else { objAnswerAmount.Text = GetSurveyInfo.Rows[0]["AnswerAmount"].ToString() + "/" + "不限"; } objAnswerAmount.Attributes.CssStyle.Add("text-decoration", "underline"); } //编辑状态 LinkButton objState = (LinkButton)grid.Rows[i].Cells[3].Controls[0]; System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image(); image.Style.Add("margin", "0"); if (NDConvert.ToInt32(grid.DataKeys[i]["State"].ToString()) == (int)CommonEnum.SurveyState.NotCreate) { image.ImageUrl = "images/SurveyNotComplate.gif"; grid.Rows[i].Cells[3].Controls.AddAt(0, image); objState.Text = "未生成"; } else { image.ImageUrl = "images/SurveyComplate.gif"; grid.Rows[i].Cells[3].Controls.AddAt(0, image); objState.Text = "已生成"; } //活动状态 LinkButton objActive = (LinkButton)grid.Rows[i].Cells[4].Controls[0]; System.Web.UI.WebControls.Image image1 = new System.Web.UI.WebControls.Image(); image1.Style.Add("margin", "0"); if (NDConvert.ToInt32(grid.DataKeys[i]["Active"].ToString()) == (int)CommonEnum.SurveyActive.InActive) { image1.ImageUrl = "images/stop.gif"; grid.Rows[i].Cells[4].Controls.AddAt(0, image1); objActive.Text = "禁用"; } else { image1.ImageUrl = "images/run.gif"; grid.Rows[i].Cells[4].Controls.AddAt(0, image1); objActive.Text = "启用"; } //审核状态 LinkButton objApproval = (LinkButton)grid.Rows[i].Cells[5].Controls[0]; if (ConvertString(grid.DataKeys[i]["ApprovalStaus"]) == ConvertString((int)CommonEnum.SurveyApprovalStaus.Waiting)) { grid.Rows[i].Cells[5].Text = "待审批"; grid.Rows[i].Cells[5].ForeColor = Color.Red; } else if (ConvertString(grid.DataKeys[i]["ApprovalStaus"]) == ConvertString((int)CommonEnum.SurveyApprovalStaus.Pass)) { grid.Rows[i].Cells[5].Text = "已通过"; grid.Rows[i].Cells[5].ForeColor = Color.Green; } else if (ConvertString(grid.DataKeys[i]["ApprovalStaus"]) == ConvertString((int)CommonEnum.SurveyApprovalStaus.Back)) { grid.Rows[i].Cells[5].Text = "被退回"; } //分析 LinkButton objStatistics = (LinkButton)grid.Rows[i].Cells[9].Controls[0]; System.Web.UI.WebControls.Image image5 = new System.Web.UI.WebControls.Image(); image5.Style.Add("margin", "0"); if (NDConvert.ToInt32(grid.DataKeys[i]["State"].ToString()) == (int)CommonEnum.SurveyState.NotCreate) { image5.ImageUrl = "images/statDisable.gif"; objStatistics.Enabled = false; } else { image5.ImageUrl = "images/stat.gif"; objStatistics.Enabled = true; } objStatistics.Text = "分析"; objStatistics.OnClientClick = "showMenuAll();"; grid.Rows[i].Cells[9].Controls.AddAt(0, image5); //选项 LinkButton objOption = (LinkButton)grid.Rows[i].Cells[10].Controls[0]; System.Web.UI.WebControls.Image image4 = new System.Web.UI.WebControls.Image(); image4.Style.Add("margin", "0"); image4.ImageUrl = "images/modifyoption.gif"; objOption.Text = "选项"; grid.Rows[i].Cells[10].Controls.AddAt(0, image4); //编辑 LinkButton objEdit = (LinkButton)grid.Rows[i].Cells[11].Controls[0]; System.Web.UI.WebControls.Image image2 = new System.Web.UI.WebControls.Image(); image2.Style.Add("margin", "0"); image2.ImageUrl = "images/edit2.gif"; objEdit.Text = "编辑"; grid.Rows[i].Cells[11].Controls.AddAt(0, image2); //删除 LinkButton objDel = (LinkButton)grid.Rows[i].Cells[12].Controls[0]; objDel.OnClientClick = "if(!window.confirm('确定要删除该数据吗?'))return false;"; System.Web.UI.WebControls.Image image3 = new System.Web.UI.WebControls.Image(); image3.Style.Add("margin", "0"); image3.ImageUrl = "images/del.gif"; objDel.Text = "删除"; grid.Rows[i].Cells[12].Controls.AddAt(0, image3); } } }