boddcreateddl.aspx:
<%@ Page language="c#" Codebehind="boddcreateddl.aspx.cs" AutoEventWireup="false" Inherits="datadictionary.boddcreateddl" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>boddcreateddl</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<LINK href="../images/style.css" type=text/css rel=stylesheet>
</HEAD>
<body class="right">
<form id="Form1" method="post" runat="server">
<asp:Panel id="Panel1" runat="server" Font-Names="宋体">填写DDL文件名:
<asp:Button id=Button1 runat="server" Text="开始导出"></asp:Button>
</asp:Panel>
<asp:Panel id="p3" runat="server" Height="104px" Width="344px" Visible="False">
<asp:TextBox id=tb2 runat="server" Height="96px" Width="344px" TextMode="MultiLine"></asp:TextBox>
</asp:Panel>
</form>
<P><asp:PlaceHolder id="MyWebControl" runat="server"></asp:PlaceHolder></P>
</body>
</HTML>
boddcreateddl.aspx.cs:
namespace datadictionary
{
/// <summary>
/// boddcreateddl 的摘要说明。
/// </summary>
public class boddcreateddl : System.Web.UI.Page
{
public string mid="",vid="",path="";
private dbmanager dbm=new dbmanager();
private commonfunction cfun=new commonfunction();
private string sql="",thetext="",thevalue="";
protected System.Web.UI.WebControls.Panel p3;
private dictionary dic=new dictionary();
protected System.Web.UI.WebControls.PlaceHolder MyWebControl;
private createddl cd=null;
private void Page_Load(object sender, System.EventArgs e)
{
this.path=Request.PhysicalPath;
this.path=path.Substring(0,path.LastIndexOf("\\")+1)+"DDLFile";
if(!Page.IsPostBack)
{
if(dbm.connect())
{
sql="select * from version where model_id="+mid;
if(dbm.ConnectedQuery(sql))
{
if(dbm.thereader.HasRows)
{
while(dbm.thereader.Read())
{
if(!dbm.thereader["version_id"].ToString().Equals(vid))
{
thevalue=dbm.thereader["version_id"].ToString();
thetext=dbm.thereader["version_value"].ToString();
tver.Items.Add(new ListItem(thetext,thevalue));
}
}
}
}
}
tver.Enabled=false;
if(dic.getPModelList())
{
for(int i=0;i<=dic.pmodeltypes.Length-1;i++)
{
thevalue=dic.pmodeltypes[i].code;
thetext=dic.pmodeltypes[i].code;
ddl1.Items.Add(new ListItem(thetext,thevalue));
}
}
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Button1_Click(object sender, System.EventArgs e)
{
if(!handler)
{
int tverid=0,pf=0,pt=0;
if(!tb1.Text.Equals(""))
{
p3.Visible=false;
this.cd=new createddl(tb1.Text,ddl1.SelectedValue,cfun.getInt(mid),cfun.getInt(vid),this.path);
if(rb1.SelectedValue.Equals("1"))
{
cd.fullcreate();
if(cd.errorinf.Equals(""))
{
LiteralControl ll=new LiteralControl("<a href="+this.cd.path+" target=_blank>请单击鼠标右键下载此.sql文件</a>");
MyWebControl.Controls .Add(ll);
}
}
else
{
tverid=cfun.getInt(tver.SelectedValue);
pf=cfun.getInt(rb2.SelectedValue);
pt=cfun.getInt(rb3.SelectedValue);
cd.pluscreate(tverid,pf,pt);
if(cd.errorinf.Equals(""))
{
LiteralControl ll=new LiteralControl("<a href="+this.cd.path+" target=_blank>请单击鼠标右键下载此.sql文件</a>");
MyWebControl.Controls .Add(ll);
}
}
p3.Visible=true;
tb2.Text=cd.checkinf+"\n"+cd.errorinf;
}
else{p3.Visible=true;tb2.Text="请填写DDL文件名!";}
handler=true;
}
}
}
}
2 个解决方案
#1
怎么没有人看帖呢?
#2
经常遇到,特别是页面上有自定义控件时更容易发生,我现在只能保证显示逻辑是正确的,但执行两次的问题一只没办法解决。
#1
怎么没有人看帖呢?
#2
经常遇到,特别是页面上有自定义控件时更容易发生,我现在只能保证显示逻辑是正确的,但执行两次的问题一只没办法解决。