posts - 23,  comments - 54,  trackbacks - 0
公告
  2005年2月20日
我做了个登陆的页面,上面只有一个button 是个webcontrol,另外还有个文本框,可是在文本框输入回车的时候却不是激发 button的onclick事件。。这是为什么呢?直接点击这个button是可以正确执行的,没有问题。
aspx文件如下
<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    
<HEAD>
        
<title>Login</title>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form id="Form1" method="post" runat="server">
            
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px" runat="server">用户名</asp:label>
            
<asp:label id="Label2" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px" runat="server">密码</asp:label>
            
<asp:textbox id="TextBoxPassword" style="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px"
                runat
="server" TextMode="Password"></asp:textbox>
            
<asp:button id="ButtonLogin" style="Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px"
                runat
="server" Text="登陆" Width="72px" Height="24px"></asp:button>
            
<asp:dropdownlist id="DropDownListUsername" style="Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px"
                runat
="server" Width="152px" Height="24px" ForeColor="Black"></asp:dropdownlist>
            
<asp:Label id="LabelLoginHints" style="Z-INDEX: 106; LEFT: 200px; POSITION: absolute; TOP: 136px"
                runat
="server" Height="16px" Width="160px" Visible="False"></asp:Label></form>
    
</body>
</HTML>

生成的html页面源代码如下


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    
<HEAD>
        
<title>Login</title>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
    
</HEAD>
    
<body MS_POSITIONING="GridLayout">
        
<form name="Form1" method="post" action="login.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" value="dDwtMjAyODkxODIxNDt0PDtsPGk8MT47PjtsPHQ8O2w8aTw5Pjs+O2w8dDx0PHA8cDxsPERhdGFNZW1iZXI7RGF0YVRleHRGaWVsZDs+O2w8WW9uZ2h1O21pbmdjaGVuZzs+Pjs+O3Q8aTwxPjtAPGFkbWluOz47QDxhZG1pbjs+Pjs+Ozs+Oz4+Oz4+Oz6mXAwirhGRHCGNRsa9w1rNH6t3GA==" />

            
<span id="Label1" style="Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 56px">用户名</span>
            
<span id="Label2" style="Z-INDEX: 102; LEFT: 176px; POSITION: absolute; TOP: 96px">密码</span>
            
<input name="TextBoxPassword" type="password" id="TextBoxPassword" style="Z-INDEX: 103; LEFT: 248px; POSITION: absolute; TOP: 96px" />
            
<input type="submit" name="ButtonLogin" value="登陆" id="ButtonLogin" style="height:24px;width:72px;Z-INDEX: 104; LEFT: 224px; POSITION: absolute; TOP: 168px" />
            
<select name="DropDownListUsername" id="DropDownListUsername" style="color:Black;height:24px;width:152px;Z-INDEX: 105; LEFT: 248px; POSITION: absolute; TOP: 56px">
    
<option value="admin">admin</option>

</select>
            
</form>
    
</body>
</HTML>

<%@ Page language="c#" Codebehind="Login.aspx.cs" AutoEventWireup="false" Inherits="gx.Login" %>可以看到input type=submit 的确在 form里面,可是就是没有效果,这是为什么呢?
多谢各位达人了
posted @ 2005-02-20 17:12 慕晓 阅读(777) 评论(1) 编辑
我是每个页面都新建一个连接,然后打开,关闭。
配置都存放在每个页面。虽然没有改动过,可是如果将来要改的话就麻烦了。

在网上查阅了一下,发现可以在web.config里面写入连接字符串,然后在每个页面里面引用。是这样引用的:

在web.config里面加入:
 <appSettings>
  <add key="SQLConnectionString" value="Auto Translate=True;User ID=sa;Tag with column collation when possible=False;Data Source=HZW;Password=hezhenwei;Initial Catalog=gx;Use Procedure for Prepare=1;Provider=SQLOLEDB.1;Persist Security Info=True;Workstation ID=HZW;Use Encryption for Data=False;Packet Size=4096"/>
 </appSettings>

这节。注意,<appSettings> 是在 <configuration> 节下面的,而不是在<system.web>下面。最开始我放错地方,它提示出现错误,然后让运行 调试 -〉开始执行(不调试)来查看web.config的错误。最开始以为名字写错了,后来查了文档才注意到放错地方了。

在web.config里面配置好后,就可以在页面里面这样使用了:

protected static string StrConn = System.Configuration.ConfigurationSettings.AppSettings["SQLConnectionString"];
  protected System.Data.OleDb.OleDbConnection ConnServer = new System.Data.OleDb.OleDbConnection(StrConn);

红色的部分我是自己加上去的。因为我没有import System.Configuration。呵呵
然后ConnServer就是你的连接了,就可以进行打开关闭等操作了。

不过我还是有点疑问就是为什么要放在web.config里面,我觉得更好的办法应当是放在一个底层的类里面,是不是呢大家?讨论讨论
posted @ 2005-02-20 16:58 慕晓 阅读(641) 评论(3) 编辑
我画的数据库的关系。不过还有点问题还要改改。
Visio画的。

posted @ 2005-02-20 15:08 慕晓 阅读(375) 评论(2) 编辑
一个朋友的公司要做个系统,是仓库管理软件,b/s结构,asp.net来做。第一个项目,所以肯定学到的东西很多,在这里记录下来,对自己希望能有所帮助。

先说一下吧

主要有几个单子:

商品进仓单
商品销货单
销货退补单
库存溢耗单
品名等级计量调整单
扦样单           
posted @ 2005-02-20 15:01 慕晓 阅读(563) 评论(1) 编辑