注册 登录
编程论坛 ASP.NET技术论坛

求助:asp.net不能显示

lbj163 发布于 2012-07-26 10:57, 555 次点击
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"  %>
<html>
<head>
</head>
<body>
<form method="post" id="form1" action="" runat="server">
    <input type="text" name="name" runat="server">
<input type="submit" value="提交" runat="server"  onclick="Clicka" >
</form>
</body>
</html>
WebForm1.aspx.cs  页面

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;


namespace WebApplication3
{
    public partial class WebForm4 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Clicka(object sender, EventArgs e)
        {
             int name1 = Convert.ToInt32(Request.Form["name"]);
             Response.Write("name1");
         

        }
    }


4 回复
#2
thdsf2012-07-26 11:21
我有种情况好像也是这样,我也很想知道
#3
pettykids2012-07-26 15:47
前台页面是:CodeBehind="WebForm1.aspx.cs" 而你的后台确是public partial class WebForm4 : System.Web.UI.Page 而且 你的namespace命名空间、、、
前台改成CodeBehind="WebApplication3.WebForm1.aspx.cs" 后台:public partial class WebForm1 : System.Web.UI.Page
试一下、
#4
一氧化碳2012-08-06 16:33
按三楼说的,使前后台命名空间代码一致,估计你是copy吧。。。。
前台加个按钮<asp:Button ID="submit" runat="server" Text="提交" onclick="submit_Click" />
再加个标签Label
<asp:Label ID="nameLB" runat="server"></asp:Label>
在后台单击事件里写

int name1 = Convert.ToInt32(Request.Form["name"]);
nameLB.Text=name1.ToString();


[ 本帖最后由 一氧化碳 于 2012-8-6 16:37 编辑 ]
1