大家帮忙看一下,我的填空题用datalist绑定的。
现在是从数据库中查询出填空题的问题为:新中国______时候成立的?
怎么样将_____改为文本框形式显示,并可能编辑。
protected void dgtiankong_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (chkTiankong.Checked)
        {
            HiddenField ht = (HiddenField)e.Item.FindControl("hidtiankong");
            Label lbl = (Label)e.Item.FindControl("lblnames");
            TextBox ts = (TextBox)e.Item.FindControl("TextBox1");                                       if ((ht != null) && (lbl != null))
            {
                if (ht.Value.ToString().Contains("T"))
                {
                    
                    lbl.Visible = true;                    
                }
            }
        }
    }

解决方案 »

  1.   

    不行啊。无法显示的。您那个Testbox是文本框的名么
      

  2.   

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <style type="text/css">
            #TextBox1{
                 border-top-width:0px;  
                  border-left-width:0px;  
                   border-right-width:0px;  
               border-bottom-width:1px;  
                border-bottom-color:Black;
            }
        </style>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="TextBox1" runat="server">aaaaaaaaa</asp:TextBox>
        </div>
        </form>
    </body>
    </html>
      

  3.   

     <div runat="server" id="tiankong">             
                        <asp:DataList ID="dgtiankong" runat="server" GridLines="None" autoGenerateColumns="false"
                            HorizontalAlign="left" Width="100%" OnItemDataBound="dgtiankong_ItemDataBound">
                            <HeaderTemplate>
                                <asp:Label ID="lbltiankong" runat="server" Text="二、填空题"></asp:Label></HeaderTemplate>
                            <ItemTemplate>                            
                                
                                <asp:Label ID="lblnames" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem,"subjectName") %>'></asp:Label>
                                <asp:TextBox ID="TextBox1"  runat="server" Visible="false" Text='' TextMode="MultiLine" BorderStyle="None"></asp:TextBox>
                                <asp:HiddenField ID="hidtiankong" runat="server" Value='<%# DataBinder.Eval(Container.DataItem,"subjecNO") %>' />
                                <br />
                            </ItemTemplate>
                        </asp:DataList></div> 这个是我的前台。
      

  4.   

    以前做过的:                 <asp:TextBox id="TextBox1" runat="server" style="BORDER-BOTTOM:   gray   1px   solid" BorderStyle="None"></asp:TextBox>
      

  5.   

    可以啊,试过了。不过用了TextMode="multiLine"多行后效果就不太好了。
     <asp:TextBox id="TextBox1" runat="server" style="BORDER-BOTTOM:gray 1px solid" BorderStyle="None"></asp:TextBox> <%--ie7,ff测试通过--%><br />
    <asp:TextBox id="TextBox2" runat="server" TextMode="multiLine" style="BORDER-BOTTOM: gray 1px solid" BorderStyle="None"></asp:TextBox> <%--ie7出现垂直滚动条,ff出现水平滚动条--%>
      

  6.   

    css样式
           #TextBox1{ 
                border-top-width:0px;  
                  border-left-width:0px;  
                  border-right-width:0px;  
              border-bottom-width:1px;  
                border-bottom-color:Black; 
      

  7.   

    在datalist中怎么将一个下划线替换成文本框.
      

  8.   

    <style type="text/css">
        .input{
    border-bottom:1px solid #007eff; /* 下划线 */
    font-family:Arial, Helvetica, sans-serif;
    color:#007eff;
    background:transparent;
    border-top:none;
    border-left:none;
    border-right:none;
    }
        </style> <asp:TextBox ID="TextBox1" runat="server" CssClass="input"></asp:TextBox>
      

  9.   

    你那个效果(就是一下划线)应该是用CSS写的,把其中的CSS改一下(大致是这样的):
    #TextBox1{    border-top-width:1px;  
                  border-left-width:1px;  
                  border-right-width:1px;  
                  border-bottom-width:1px;  
                  border-color:Black; 
      

  10.   

    能具体给个例子吗[email protected]谢谢
      

  11.   


        <style type="text/css">
            .textbox1
            {
             border-bottom:solid 1px #999999;
             border-left:0px;
             border-top:0px;
             border-right:0px;
            }
        </style>
        <div>
             新中国<asp:TextBox ID="TextBox3" runat="server" CssClass="textbox1"></asp:TextBox>
             时候成立的?
             <br />
             新中国<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>时候成立的?
        </div>你看一下这两个效果