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

CS0103: 当前上下文中不存在名称“Textbox1”

水晶心 发布于 2010-08-17 11:21, 4665 次点击
<td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="label" runat="server" Height="36px" Style="z-index: 100; left: 28px;
                        position: absolute; top: 136px" Text="考勤编号:" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="Label1" runat="server" Height="36px" Style="z-index: 100; left: 26px;
                        position: absolute; top: 297px" Text="考勤日期" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:TextBox ID="T_kid" runat="server" Height="30px" Style="z-index: 100; left: 215px;
                        position: absolute; top: 137px" Width="173px"></asp:TextBox>
                    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                        DataTextField="lx" DataValueField="xid" Style="z-index: 102; left: 625px; position: absolute;
                        top: 143px">


protected void  Calendar1_SelectionChanged(object sender, EventArgs e)
{
 Textbox1.Text   =   Calendar1.SelectedDate.ToShortDateString();
}
    protected void  Calendar2_SelectionChanged(object sender, EventArgs e)
{
Textbox2.Text   =   Calendar2.SelectedDate.ToShortDateString();
}
}
5 回复
#2
foktime2010-08-17 12:10
无语啊姐姐...
就是说缺少id为Textbox1、Textbox2的Textbox控件啊 都没有你给谁赋Text啊
#3
yukai6212010-08-17 13:47
<td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="label" runat="server" Height="36px" Style="z-index: 100; left: 28px;
                        position: absolute; top: 136px" Text="考勤编号:" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="Label1" runat="server" Height="36px" Style="z-index: 100; left: 26px;
                        position: absolute; top: 297px" Text="考勤日期" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:TextBox ID="TextBox1" runat="server" Height="30px" Style="z-index: 100; left: 215px;
                        position: absolute; top: 137px" Width="173px"></asp:TextBox>
                    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                        DataTextField="lx" DataValueField="xid" Style="z-index: 102; left: 625px; position: absolute;
                        top: 143px">
这个应该不会在报你说的那个错了
#4
yukai6212010-08-17 13:49
<td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="label" runat="server" Height="36px" Style="z-index: 100; left: 28px;
                        position: absolute; top: 136px" Text="考勤编号:" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:Label ID="Label1" runat="server" Height="36px" Style="z-index: 100; left: 26px;
                        position: absolute; top: 297px" Text="考勤日期" Width="177px"></asp:Label>
                </td>
                <td style="width: 794px; height: 50px; text-align: center">
                    <asp:TextBox ID="TextBox1" runat="server" Height="30px" Style="z-index: 100; left: 215px;
                        position: absolute; top: 137px" Width="173px"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" Height="30px" Style="z-index: 100; left: 215px;
                        position: absolute; top: 137px" Width="173px"></asp:TextBox>

                    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                        DataTextField="lx" DataValueField="xid" Style="z-index: 102; left: 625px; position: absolute;
                        top: 143px">
#5
水晶心2010-08-17 14:48
<table style="z-index: 100; left: 0px; position: absolute; top: 0px">
            <tr>
                <td colspan="4" rowspan="2" style="height: 121px; text-align: center">
                    <span style="font-size: 32pt">考勤管理系统<br />
                        <span style="font-size: 11pt">&nbsp;
                            <asp:TextBox ID="TextBox1" runat="server" Height="29px" Style="z-index: 100;
                            left: 213px; position: absolute; top: 300px" Width="175px"></asp:TextBox>
                            <asp:Calendar ID="Calendar1" runat="server" Style="z-index: 101; left: 418px; position: absolute;
                                top: 298px" OnSelectionChanged="Calendar1_SelectionChanged"></asp:Calendar>
                            <asp:Calendar ID="Calendar2" runat="server" Style="z-index: 102; left: 161px; position: absolute;
                                top: 396px" OnSelectionChanged="Calendar2_SelectionChanged"></asp:Calendar>
                            &nbsp;
我这里定义了TextBox ID="TextBox1
#6
冰镇柠檬汁儿2010-08-20 09:57
错误解决了吗?
从你在一楼发的帖子看,确实没有TextBox1的定义,要不你把整个文件的代码发上来。
1