| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 374 人关注过本帖
标题:C#初级问题2
只看楼主 加入收藏
chenou
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2006-4-21
收藏
 问题点数:0 回复次数:2 
C#初级问题2

图片附件: 游客没有浏览图片的权限,请 登录注册

图片附件: 游客没有浏览图片的权限,请 登录注册

这是一个HTML页面:

<form method="post" id="form1" action="Default.aspx">
<center>
<table cellpadding="0" cellspacing="0" style="width: 408px; height: 96px">
<tr>
<td style="width: 256px; height: 22px">
</td>
<td style="width: 674px; height: 22px;">
<input id="txtUserName" style="width: 168px" type="text" /></td>
<td style="width: 133px; height: 22px;">
</td>
</tr>
<tr>
<td style="width: 256px">
</td>
<td style="width: 674px">
<input id="txtUserPwd" style="width: 168px" type="text" /></td>
<td style="width: 133px">
</td>
</tr>
<tr>
<td style="width: 256px">
</td>
<td style="width: 674px">
<input id="Submit1" type="submit" value="提 交" /></td>
<td style="width: 133px">
</td>
</tr>
</table>
</center>
</form>

这是调用的页面,怎么总是提示出错啊?

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.txtusername.Text = "";
this.txtuserpwd.Text = "";
}
this.btnclose.Attributes.Add("onclick", "window.close();");
//string userName = Request[txtusername.Text].ToString();
//String userPwd = Request[txtuserpwd.Text].ToString();
string userName = Request.Form.Get(txtusername).ToString;
string userPwd = Request.Form.Get(txtuserpwd).ToString;
Response.Write("你的用户名是" + userName + "密码是:" + userPwd);
}

protected void btnLogin_Click(object sender, EventArgs e)
{
if (this.txtusername.Text == "a" && this.txtuserpwd.Text == "a")
{
lblmessage.Text = "登录成功";
}
else
{
lblmessage.Text = "登录失败";
this.txtusername.Focus();

}
}
protected void btnclear_Click(object sender, EventArgs e)
{
this.txtusername.Text = "";
this.txtuserpwd.Text = "";
}
}


搜索更多相关主题的帖子: 初级 
2006-10-22 14:20
li_meng5939
Rank: 1
等 级:新手上路
帖 子:89
专家分:0
注 册:2006-3-24
收藏
得分:0 
好象txtusername应该后加属性.text

我爱 vb
但我看了两遍书 觉得增长太少
能解决的问题太少了
我想学多点 好点
谢谢个位高手赐教!!
我不甚感激
2006-10-22 16:57
ascor
Rank: 1
等 级:新手上路
帖 子:102
专家分:0
注 册:2006-4-19
收藏
得分:0 
....
tostring 后面少了个 ()
2006-10-23 10:33
快速回复:C#初级问题2
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015329 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved