aaaa
aaaa

Reputation: 11

How to make the Horizontal line dynamically?

In my aspx page there is tow label one is mobile no and second is land line no, when user click on the link button "Laandline No" a three text boxes should be visibal automatically and under this horizontal line display and when user click again textbox should be visibal false and horizontal line display under the mobile no. In short horizontal line change the position dynamically.

Upvotes: 1

Views: 5910

Answers (2)

programmer
programmer

Reputation: 918

Use new System.Web.UI.HtmlControls.HtmlGenericControl("hr"). You can use the HtmlGenericControl class and create a HR dynamically and add this newly created control to the other controls you have could be panel or frame etc..

Upvotes: 3

TheGeekYouNeed
TheGeekYouNeed

Reputation: 7539

Make a and put a runat=server tag in it. Add a border css style to the div to show a horizontal line. You have much more control of how the line looks this way, too. It is my opinion, but I never use an <hr> tag for lines. Here is one way to do it:

 aspx
 <div id="separator" runat="server" class="underline"/>
 <asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
 <asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
 <asp:TextBox id="TextBox3" runat="server"></asp:TextBox>

 cs:
 // LinkButton "Mobile" click event

 separator.Visible = false;
 TextBox1.Visible = false;
 TextBox2.Visible = false;
 TextBox3.Visible = false;

 // LinkButton "Landline" click event
 separator.Visible = true;
 TextBox1.Visible = true;
 TextBox2.Visible = true;
 TextBox3.Visible = true;

css
.underline
{
    border: 1px solid black;

}

Upvotes: 0

Related Questions