html控件 asp控件都不能访问 但是在自动补全提示里面又有出现,代码如下:后台:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using CSMS_lib;public partial class baseinfo_Input : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }    protected void Submit_Click(object sender, EventArgs e)
    {
        string name = this.textName.Value.Trim();
        bool sex = Convert.ToBoolean(Convert.ToInt32(this.RadioButgender.SelectedValue));
        int IsMarried = Convert.ToInt32(this.RadioButIsMarried.SelectedValue);
        string ProvinceOfOrigin = this.textProvince.Value.Trim();
        string CityOfOrigin = this.textCity.Value.Trim();
        string IDCard = this.textIDCard.Value.Trim();
        string Phone = this.textPhone.Value.Trim();
        string EmployeeCardID = this.textEmployeeCardID.Value.Trim();
        CSMS_lib.baseinfo_manager.AddBaseinfo(name, sex, IsMarried, ProvinceOfOrigin, CityOfOrigin, IDCard, Phone, EmployeeCardID);
    }
}
错误如下:
错误 93 “baseinfo_Input”不包含“textName”的定义,并且找不到可接受类型为“baseinfo_Input”的第一个参数的扩展方法“textName”(是否缺少 using 指令或程序集引用?) F:\hetong\CSMS_lx\CSMS_Web\baseinfo\Input.aspx.cs 19 14 F:\...\CSMS_Web\其他如this.RadioButgender等也有这样的错误页面代码如下:
<td width="11%" style="border-right-style: solid;">
<input tyep="text" runat="server" id="textName" size="30" maxlength="12" style="width: 80px;" />
</td>急,盼高人解决~~

解决方案 »

  1.   

    补充:前台用到了content控件 应用了一个master 页面
      

  2.   

    ASP.NET2.0以前需要,你都用母版页了,应该不是这个问题。
    把页面代码贴全看看
    如果有designer,也贴出来
      

  3.   

    应该没有问题,<input tyep="text" runat="server" id="textName" size="30" maxlength="12" style="width: 80px;" /> 
    </td>有了runat="server",那么textname就已经是服务器控件了。看来问题不是出在这里。当然如果上面这一句话不是在设计窗口设定,而是代码生成的,那就没有作用了。
      

  4.   

    runat="server"可以获取到,贴出其他代码
    或使用 Request.Form取值
      

  5.   

    先谢谢大家的热心帮助,我还是第一次发贴上来问问题
    前台代码入下,比较多,分多贴<%@ Page Language="C#" MasterPageFile="~/FunctionPage.master" AutoEventWireup="true"
        CodeFile="Input.aspx.cs" Inherits="baseinfo_Input" %>
        
    <asp:Content ID="Content1" ContentPlaceHolderID="StyleContent" runat="server">
        <meta name="Generator" content="Microsoft Word 12 (filtered)" />
        <link rel="stylesheet" href="../css/ui.core.css" type="text/css" />
        <link rel="stylesheet" href="../css/ui.theme.css" type="text/css" />
        <link rel="stylesheet" href="../css/ui.tabs.css" type="text/css" />    <script type="text/javascript" src="../js/jquery-1.3.2.js"></script>    <script type="text/javascript" src="../js/ui.core.js"></script>    <script type="text/javascript" src="../js/ui.tabs.js"></script>    <script type="text/javascript">
            $(document).ready(function() {
                $("#example").tabs();
                $("#event").click(function() {
                    $("#example").tabs({
                        event: "mouseover"
                    });
                });            $("#selected").click(function() {
                    $("#example").tabs({
                        selected: 2
    , cache: true
    , fixSlide: true
                    });
                });            $("#fx").click(function() {
                    $("#example").tabs({
                        fx: {
                            height: 'toggle',
                            opacity: 'toggle',
                            duration: 'fast'
                        }
                    });
                });            $("#add").click(function() {
                    //$("#example").tabs('add','#new-tab', 'New Tab');
                    $("#example").tabs('add', 'test.html', 'New Tab', 1);
                });            $("#remove").click(function() {
                    $("#example").tabs('remove', 1);
                });            $("#disable").click(function() {
                    alert("ok");
                    $("#example").tabs('disable', 0);
                });            $("#enable").click(function() {
                    $("#example").tabs('enable', 0);
                });
            });
        </script>    <style type="text/css">
            .style9
            {
                width: 5%;
            }
            .style10
            {
                width: 6%;
            }
            .style11
            {
                width: 17%;
            }
            .style12
            {
                width: 16%;
            }
            .style15
            {
                width: 72px;
            }
            .style16
            {
                width: 80px;
            }
            .style17
            {
                width: 172px;
            }
            .style18
            {
                width: 53px;
            }
            .style19
            {
                width: 86px;
            }
            .style20
            {
                width: 125px;
            }
        </style>
    </asp:Content>
      

  6.   

    <asp:Content ID="ContentBaseInfo" ContentPlaceHolderID="FunctionPage" runat="Server">
        <table width="100%" border="1px">
            <tr>
                <td colspan="3" height="20">
                </td>
            </tr>
            <tr>
                <td height="300" width="5%">
                </td>
                <td>
                    <div id="example" style="height: 100%;">
                        <ul>
                            <li><a href="#tab-1"><span>基本信息</span></a></li>
                            <li><a href="#tab-2"><span>简历</span></a></li>
                            <li><a href="#tab-3"><span>家庭成员</span></a></li>
                        </ul>
                        <div id="tab-1">
                            <fieldset>
                                <legend>必填项 </legend>
                                <table width="39%" style="width: 100%; border: 1px;">
                                    <tr>
                                        <td class="style9">
                                            <div align="right">
                                                姓名:</div>
                                        </td>
                                        <td width="11%" style="border-right-style: solid;">
                                            <input tyep="text" runat="server" id="textName" size="30" maxlength="12" style="width: 80px;" />
                                        </td>
                                        <td class="style10">
                                            <div align="right">
                                                出生日期:</div>
                                        </td>
                                        <td style="border-right-style: solid;" class="style11">
                                            <input runat="server" id="textBirthYear" type="text" size="30" maxlength="12" style="width: 60px" />
                                            年
                                            <select runat="server" id="selBirthMonth">
                                            </select>
                                            月
                                            <select runat="server" id="selBirthDay">
                                            </select>
                                            日
                                        </td>
                                        <td width="14%">
                                            <div align="right">
                                                户口性质:</div>
                                        </td>
                                        <td width="15%">
                                            <asp:RadioButtonList ID="RadioButRPR" runat="server" RepeatDirection="Horizontal">
                                                <asp:ListItem Text="城镇" Value="1" Selected="True" />
                                                <asp:ListItem Text="农村" Value="0" />
                                            </asp:RadioButtonList>
                                        </td>
      

  7.   

    </div>
                        <div id="tab-2">
                            <table style="width: 100%;">
                                <tr>
                                    <td colspan="2">
                                        <div align="center">
                                            <u>自何时起 </u>
                                        </div>
                                    </td>
                                    <td colspan="2">
                                        <div align="center">
                                            <u>到何时止</u></div>
                                    </td>
                                    <td width="77%" rowspan="2">
                                        <div align="center">
                                            <u>在何地何单位从事何工作 </u>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td width="6%">
                                        <div align="center">
                                            <u>年</u></div>
                                    </td>
                                    <td width="5%">
                                        <div align="center">
                                            <u>月</u></div>
                                    </td>
                                    <td width="6%">
                                        <div align="center">
                                            <u>年</u></div>
                                    </td>
                                    <td width="6%">
                                        <div align="center">
                                            <u>月</u></div>
                                    </td>
                                </tr>
     </table>
                        </div>
                        <div id="tab-3">
                            Haha, three is here.
                        </div>
                    </div>
                    
                </td>
                <td width="5%">
                </td>
            </tr>
            <tr>
                <td colspan="3" style="height: 60px">
                <asp:Button ID="ButSubmit" runat="server" Text="提交" OnClick="Submit_Click" />
                </td>
            </tr>
        </table>
    </asp:Content>
      

  8.   

    原来只能连续回帖3次···
    ps:我用的是VS2008
      

  9.   

    <input tyep="text" runat="server" id="textName" size="30" maxlength="12" style="width: 80px;" /> html控件尽量使用 服务器控件 即使你加了runat=“server”
    尽量少使用htnl废弃标签 align (这个问题和这个没关系)
    可能是模板页容器的问题前台注意控件改名字可能引起这些问题
      

  10.   

    再贴出母模板页前台代码如下:<%@ Master Language="C#" AutoEventWireup="true" CodeFile="FunctionPage.master.cs"
        Inherits="MasterPage" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <asp:ContentPlaceHolder ID="StyleContent" runat="server">
        </asp:ContentPlaceHolder>
        <style type="text/css">
            html, body, form, .contentTable
            {
                width: 100%;
            }
            body
            {
                margin: 0px;
            }
            .contentTable
            {
                padding-left: 5px;
            }
            .functionNav
            {
                padding-left: 10px;
                background-color: #bcdeea;
                height: 23px;
                font-size: 12px;
                vertical-align: middle;
            }
            .functionPage
            {
                padding-top: 5px;
            }
            .functionNavRight
            {
                text-align: right;
                padding-right: 12px;
                vertical-align: middle;
            }
            .navTable
            {
                margin-left: auto;
                margin-right: 0px;
            }
            .alterTD
            {
                padding-right: 10px;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <table cellpadding="0px" cellspacing="0px" border="0px" class="contentTable">
            <tbody>
                <tr>
                    <td class="functionNav">
                        <table cellpadding="0px" cellspacing="0px" border="0px" class="contentTable">
                            <tbody>
                                <tr>
                                    <td>
                                    <!--
                                        当前位置:<asp:SiteMapPath runat="server" ID="SiteMapPath1">
                                        </asp:SiteMapPath>
                                        -->
                                    </td>
                                    <td class="functionNavRight">
                                        <table cellpadding="0px" cellspacing="0px" border="0px" class="navTable">
                                            <tbody>
                                                <tr>
                                                    <td>
                                                        <asp:Image runat="server" ID="ImageBack" ImageUrl="~/images/guide/back.gif" onclick="javascript:history.back();" />
                                                    </td>
                                                    <td class="alterTD">
                                                        <a href="#" onclick="javascript:history.back();">后退</a>
                                                    </td>
                                                    <td>
                                                        <asp:Image runat="server" ID="ImageRefresh" ImageUrl="~/images/guide/refresh.gif" onclick="javascript:location.reload();" />
                                                    </td>
                                                    <td class="alterTD">
                                                        <a href="#" onclick="javascript:location.reload();">刷新</a>
                                                    </td>
                                                    <td>
                                                        <asp:Image runat="server" ID="ImageForward" ImageUrl="~/images/guide/forward.gif" onclick="javascript:history.forward();" />
                                                    </td>
                                                    <td>
                                                        <a href="#" onclick="javascript:history.forward();">前进</a>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="functionPage">
                        <asp:ContentPlaceHolder ID="FunctionPage" runat="server">
                        </asp:ContentPlaceHolder>
                    </td>
                </tr>
            </tbody>
        </table>
        </form>
    </body>
    </html>
      

  11.   

    自己找出了问题···
    原来是在另一个页面的codefile也引用了baseinfo.aspx.cs
    我囧囧囧
    还是谢谢大家~