【问题标题】:I have two textboxes first Textbox is placed in 1 row of 1 column and other in 45th row of 1st column in asp.net table?我有两个文本框,第一个文本框放置在 1 行 1 列中,其他放置在 asp.net 表中第 1 列的第 45 行中?
【发布时间】:2010-11-19 14:11:01
【问题描述】:

我希望如果 checkbox1 被选中,那么 textbox45 将可见并且 textbox1 将被禁用..

但我希望 textbox45 将取代 textbox1。

如果我再次选中复选框 1 和复选框 2,那么 textbox1 和文本框 2 将在 asp.net 表的第一行和第二行中可见...怎么做?

【问题讨论】:

    标签: asp.net vb.net


    【解决方案1】:

    有这样的复选框控件 -

    <asp:CheckBox id="checkbox1" runat="server"
                        AutoPostBack="True"
                        Text="checkbox1"                    
                        OnCheckedChanged="Check1_Clicked"/>
    

    然后,您可以像这样创建文本框控件,然后

    <asp:TextBox ID="txtbox1"
                        visible="false"
                        runat="server"/>
    

    在 Check1_Clicked 事件上 -

    void Check1_Clicked(Object sender, EventArgs e) 
    {    
        txtbox1.Visible = False;
        txtbox45.Visible = True;
    
        //After controlling the visiblity, you can dynamically position your textbox on your form.
        txtbox45.Style("Position") = "Absolute"
        txtbox45.Style("Top") = "50px"
        txtbox45.Style("Left") = "100px"  
        // provide suitable values to position the textbox accordingly for all your textboxes
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-08-11
      • 1970-01-01
      • 2015-08-10
      • 2020-02-08
      • 1970-01-01
      • 2011-04-03
      • 1970-01-01
      • 2015-06-21
      相关资源
      最近更新 更多