后台 :using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using StoredProcedure;
using JsFunction;
using WebFunction;
using Function;
public partial class Jybg_jyxm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["User"] != null)//cookic判断是否为空
{
HiddenUser.Value = HttpUtility.UrlDecode(Request.Cookies["User"].Value);
HiddenConfig.Value = FunCls.GetPost(HiddenUser.Value);
if (HiddenConfig.Value == "")
{
Response.Redirect("../error.aspx");
}
}
else
{
Response.Redirect("../error.aspx");
}
if (Request.QueryString["bgbh"] != null)//cookic判断是否为空
{
TextBgbh.Text = Request.QueryString["bgbh"];
}
else if (Request.Cookies["Bgbh"] != null)
{
TextBgbh.Text = HttpUtility.UrlDecode(Request.Cookies["Bgbh"].Value);
}
GridViewBgbhBind();
GridViewJyxmBind();
}
//设置JavaScript
SetJs();
SetBgfl();
//设置焦点
SetFocus("TextXm");
}
protected void SetJs()//设置js
{
JsCls.SetIsChangeJs(this.Controls);
JsCls.SetJmInputJs(TextBz);
JsCls.SetKeyInputJs(TextPdbz);
}
protected void SetText()//设置默认
{
//TextXm.Text = "";
//TextBz.Text = "";
//TextDw.Text = "";
ButtonJyxmInsert.Enabled = false;
ButtonJyxmDelete.Enabled = false;
ButtonJyxmEdit.Enabled = false;
SetFocus("TextXm");
}
protected void SetBgfl()//报告分类
{
string sql = "select distinct left(报告编号,5) as bgfl from ViewBgbh where 综合判定='/' and 报告编号 not in (select 报告编号 from ViewJyxm where 总项数>0) order by bgfl";
DataTable dt = SpCls.GetDt(sql);
for (int i = 0; i < dt.Rows.Count; i++)
{
RadioButton rb = new RadioButton();
rb.ID = "RadioButtonBgfl" + (i + 1).ToString();
rb.Text = dt.Rows[i]["bgfl"].ToString();
rb.GroupName = "bgfl";
rb.AutoPostBack = true;
rb.ForeColor = Color.ForestGreen;
PanelSelect.Controls.Add(rb);
rb.CheckedChanged += new EventHandler(RadioButton_CheckedChanged);
}
}
protected void GridViewBgbh_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "RowSelected('GridViewBgbh'," + (e.Row.RowIndex + 1).ToString() + ");");
e.Row.Attributes["style"] = "Cursor:hand";
}
e.Row.Cells[4].Style.Add("display", "none");
e.Row.Cells[5].Style.Add("display", "none");
}
protected void GridViewBgbhBind()
{
string sql = "select * from ViewBgbh where 综合判定='/' and 报告编号 not in (select 报告编号 from ViewJyxm where 总项数>0) ";
foreach (Control ctl in this.Page.FindControl("PanelSelect").Controls)
{
if (ctl is RadioButton)
{
RadioButton rb = (RadioButton)ctl;
if (rb.Checked)
{
switch (rb.ID)
{
case "RadioButtonBgfl0":
sql=sql+ " order by 报告编号";
break;
default:
sql=sql+ " and 报告编号 like '" + rb.Text + "%' order by 报告编号";
break;
}
}
}
}
//sql = "select * from ViewBgbh where 报告编号 like '%ck%'";
WebCls.GridViewBind(GridViewBgbh, sql);
}
protected void GridViewJyxm_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "RowSelected('GridViewJyxm'," + (e.Row.RowIndex + 1).ToString() + ");");
e.Row.Attributes["style"] = "Cursor:hand";
}
e.Row.Cells[0].Style.Add("display", "none");
e.Row.Cells[1].Style.Add("display", "none");
e.Row.Cells[3].Style.Add("display", "none");
e.Row.Cells[4].Style.Add("display", "none");
e.Row.Cells[8].Style.Add("display", "none");
e.Row.Cells[9].Style.Add("display", "none");
//e.Row.Cells[12].Style.Add("display", "none");
e.Row.Cells[13].Style.Add("display", "none");
e.Row.Cells[14].Style.Add("display", "none");
if (e.Row.RowIndex != -1)
{
if (e.Row.Cells[10].Text != "/")
{
e.Row.Cells[10].Text = "<a href=javascript:OpenPDF('" + e.Row.Cells[10].Text + "')>" + e.Row.Cells[10].Text + "</a>";
}
if (e.Row.Cells[11].Text != "/")
{
e.Row.Cells[11].Text = "<a href=javascript:OpenPDF('" + e.Row.Cells[11].Text + "')>" + e.Row.Cells[11].Text + "</a>";
}
e.Row.Cells[7].Text = Server.HtmlDecode(e.Row.Cells[7].Text);
}
}
protected void GridViewJyxmBind()
{
string sql = "select * from ViewJyxm where 报告编号='" + TextBgbh.Text + "' order by 序号";
WebCls.GridViewBind(GridViewJyxm, sql);
}
protected void ButtonJyxmRead_Click(object sender, EventArgs e)
{
GridViewJyxmBind();
if (GridViewJyxm.Rows.Count == 0)
{
ButtonYlbz.Enabled = true;
ButtonXsbg.Enabled = true;
}
else
{
ButtonYlbz.Enabled = false;
ButtonXsbg.Enabled = false;
}
}
protected void FindBz(object sender, EventArgs e)//查找已录标准或相似报告
{
var button = sender as Button;
switch (button.ClientID)//获得点击按钮的ID
{
case "ButtonXsbg":
Response.Redirect("bgcx.aspx?bgbh=" + TextBgbh.Text + "&bzh=" + HiddenPdbz.Text);
break;
case "ButtonYlbz":
Response.Redirect("../Bzgl/bzxz.aspx?bgbh=" + TextBgbh.Text + "&bzh=" + HiddenPdbz.Text);
break;
}
}
protected void SaveJyxmData(object sender, EventArgs e)//保存通讯录数据的修改
{
Int32 RowIndex = GridViewJyxm.Rows.Count;
string[] InputData = { "", "", "", "", "", "", "", "", "", "", "", "", "" };
InputData[0] = HiddenUser.Value;
InputData[1] = TextBgbh.Text;
InputData[2] = TextXh.Text;
InputData[3] = TextXm.Text;
InputData[4] = TextDw.Text;
InputData[5] = TextBz.Text;
InputData[6] = TextJybz.Text;
InputData[7] = TextPdbz.Text;
InputData[8] = HiddenJyxmId.Text;
var button = sender as Button;
switch (button.ClientID)//获得点击按钮的ID
{
case "ButtonJyxmAdd":
RowIndex = RowIndex + 1;
InputData[2] = "0";
InputData[8] = "0";
break;
case "ButtonJyxmDelete":
InputData[0] = "删除";
break;
case "ButtonJyxmEdit":
break;
case "ButtonJyxmInsert":
InputData[8] = "0";
break;
}
SpCls.SaveJyxmData(InputData);
GridViewJyxmBind();//保存修改日期及人员
}
protected void GridViewBgbh_PageIndexChanged(object sender, EventArgs e)
{
GridViewBgbhBind();
}
protected void GridViewBgbh_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridViewBgbh.PageIndex = e.NewPageIndex;
}
protected void RadioButton_CheckedChanged(object sender, EventArgs e)//选择类别
{
GridViewBgbhBind();
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using StoredProcedure;
using JsFunction;
using WebFunction;
using Function;
public partial class Jybg_jyxm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["User"] != null)//cookic判断是否为空
{
HiddenUser.Value = HttpUtility.UrlDecode(Request.Cookies["User"].Value);
HiddenConfig.Value = FunCls.GetPost(HiddenUser.Value);
if (HiddenConfig.Value == "")
{
Response.Redirect("../error.aspx");
}
}
else
{
Response.Redirect("../error.aspx");
}
if (Request.QueryString["bgbh"] != null)//cookic判断是否为空
{
TextBgbh.Text = Request.QueryString["bgbh"];
}
else if (Request.Cookies["Bgbh"] != null)
{
TextBgbh.Text = HttpUtility.UrlDecode(Request.Cookies["Bgbh"].Value);
}
GridViewBgbhBind();
GridViewJyxmBind();
}
//设置JavaScript
SetJs();
SetBgfl();
//设置焦点
SetFocus("TextXm");
}
protected void SetJs()//设置js
{
JsCls.SetIsChangeJs(this.Controls);
JsCls.SetJmInputJs(TextBz);
JsCls.SetKeyInputJs(TextPdbz);
}
protected void SetText()//设置默认
{
//TextXm.Text = "";
//TextBz.Text = "";
//TextDw.Text = "";
ButtonJyxmInsert.Enabled = false;
ButtonJyxmDelete.Enabled = false;
ButtonJyxmEdit.Enabled = false;
SetFocus("TextXm");
}
protected void SetBgfl()//报告分类
{
string sql = "select distinct left(报告编号,5) as bgfl from ViewBgbh where 综合判定='/' and 报告编号 not in (select 报告编号 from ViewJyxm where 总项数>0) order by bgfl";
DataTable dt = SpCls.GetDt(sql);
for (int i = 0; i < dt.Rows.Count; i++)
{
RadioButton rb = new RadioButton();
rb.ID = "RadioButtonBgfl" + (i + 1).ToString();
rb.Text = dt.Rows[i]["bgfl"].ToString();
rb.GroupName = "bgfl";
rb.AutoPostBack = true;
rb.ForeColor = Color.ForestGreen;
PanelSelect.Controls.Add(rb);
rb.CheckedChanged += new EventHandler(RadioButton_CheckedChanged);
}
}
protected void GridViewBgbh_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "RowSelected('GridViewBgbh'," + (e.Row.RowIndex + 1).ToString() + ");");
e.Row.Attributes["style"] = "Cursor:hand";
}
e.Row.Cells[4].Style.Add("display", "none");
e.Row.Cells[5].Style.Add("display", "none");
}
protected void GridViewBgbhBind()
{
string sql = "select * from ViewBgbh where 综合判定='/' and 报告编号 not in (select 报告编号 from ViewJyxm where 总项数>0) ";
foreach (Control ctl in this.Page.FindControl("PanelSelect").Controls)
{
if (ctl is RadioButton)
{
RadioButton rb = (RadioButton)ctl;
if (rb.Checked)
{
switch (rb.ID)
{
case "RadioButtonBgfl0":
sql=sql+ " order by 报告编号";
break;
default:
sql=sql+ " and 报告编号 like '" + rb.Text + "%' order by 报告编号";
break;
}
}
}
}
//sql = "select * from ViewBgbh where 报告编号 like '%ck%'";
WebCls.GridViewBind(GridViewBgbh, sql);
}
protected void GridViewJyxm_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "RowSelected('GridViewJyxm'," + (e.Row.RowIndex + 1).ToString() + ");");
e.Row.Attributes["style"] = "Cursor:hand";
}
e.Row.Cells[0].Style.Add("display", "none");
e.Row.Cells[1].Style.Add("display", "none");
e.Row.Cells[3].Style.Add("display", "none");
e.Row.Cells[4].Style.Add("display", "none");
e.Row.Cells[8].Style.Add("display", "none");
e.Row.Cells[9].Style.Add("display", "none");
//e.Row.Cells[12].Style.Add("display", "none");
e.Row.Cells[13].Style.Add("display", "none");
e.Row.Cells[14].Style.Add("display", "none");
if (e.Row.RowIndex != -1)
{
if (e.Row.Cells[10].Text != "/")
{
e.Row.Cells[10].Text = "<a href=javascript:OpenPDF('" + e.Row.Cells[10].Text + "')>" + e.Row.Cells[10].Text + "</a>";
}
if (e.Row.Cells[11].Text != "/")
{
e.Row.Cells[11].Text = "<a href=javascript:OpenPDF('" + e.Row.Cells[11].Text + "')>" + e.Row.Cells[11].Text + "</a>";
}
e.Row.Cells[7].Text = Server.HtmlDecode(e.Row.Cells[7].Text);
}
}
protected void GridViewJyxmBind()
{
string sql = "select * from ViewJyxm where 报告编号='" + TextBgbh.Text + "' order by 序号";
WebCls.GridViewBind(GridViewJyxm, sql);
}
protected void ButtonJyxmRead_Click(object sender, EventArgs e)
{
GridViewJyxmBind();
if (GridViewJyxm.Rows.Count == 0)
{
ButtonYlbz.Enabled = true;
ButtonXsbg.Enabled = true;
}
else
{
ButtonYlbz.Enabled = false;
ButtonXsbg.Enabled = false;
}
}
protected void FindBz(object sender, EventArgs e)//查找已录标准或相似报告
{
var button = sender as Button;
switch (button.ClientID)//获得点击按钮的ID
{
case "ButtonXsbg":
Response.Redirect("bgcx.aspx?bgbh=" + TextBgbh.Text + "&bzh=" + HiddenPdbz.Text);
break;
case "ButtonYlbz":
Response.Redirect("../Bzgl/bzxz.aspx?bgbh=" + TextBgbh.Text + "&bzh=" + HiddenPdbz.Text);
break;
}
}
protected void SaveJyxmData(object sender, EventArgs e)//保存通讯录数据的修改
{
Int32 RowIndex = GridViewJyxm.Rows.Count;
string[] InputData = { "", "", "", "", "", "", "", "", "", "", "", "", "" };
InputData[0] = HiddenUser.Value;
InputData[1] = TextBgbh.Text;
InputData[2] = TextXh.Text;
InputData[3] = TextXm.Text;
InputData[4] = TextDw.Text;
InputData[5] = TextBz.Text;
InputData[6] = TextJybz.Text;
InputData[7] = TextPdbz.Text;
InputData[8] = HiddenJyxmId.Text;
var button = sender as Button;
switch (button.ClientID)//获得点击按钮的ID
{
case "ButtonJyxmAdd":
RowIndex = RowIndex + 1;
InputData[2] = "0";
InputData[8] = "0";
break;
case "ButtonJyxmDelete":
InputData[0] = "删除";
break;
case "ButtonJyxmEdit":
break;
case "ButtonJyxmInsert":
InputData[8] = "0";
break;
}
SpCls.SaveJyxmData(InputData);
GridViewJyxmBind();//保存修改日期及人员
}
protected void GridViewBgbh_PageIndexChanged(object sender, EventArgs e)
{
GridViewBgbhBind();
}
protected void GridViewBgbh_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridViewBgbh.PageIndex = e.NewPageIndex;
}
protected void RadioButton_CheckedChanged(object sender, EventArgs e)//选择类别
{
GridViewBgbhBind();
}
}
解决方案 »
- 怎么判断字符串中是否有某个汉字?
- 显示日志总数的问题
- 用asp.net 新建WebFrom的时候总提示collection.part 为空或不是对象,如何解决?
- 投票问题!
- 请问如何用ASP.NET服务器代码得到Javascript里的变量值.再用标签框显示出来
- 急!如何显示文件目录:就和资源管理器的一样!
- FormsAuthentication与Session的关系?
- Xmlhttp如何截获发送到服务器后未转向的返回信息?
- 关于AssemblyName的问题
- 学完了asp.net,想研究点例子,大家给推荐几个?
- 用vs2010的asp.net做WebSite,如何在母版中做左侧导航树?
- Asp.net后台怎样过滤Html 网页中第一个Div标签中的所有内容、包括div
另外别一次从数据库取出所有数据,你数据多的话,会慢的一塌糊涂,甚至死机。
代码太乱了,怎么能用的比asp还乱呢。
还有 ,你可以把所有的SQL语句 拿进查询分析器测试执行速度。