• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

Textbox - how to programatically create a textbox with scolling and vertical alignment top

I need to programatically create a System.Web.UIControls.text box with scrolling and vertical alignment top...  

TextBox txt = new TextBox();
 txt.Height = 200;

.... want next?
1 Solution
Johny BravoCommented:
>>with scrolling and vertical alignment top

Scrolling? Do you want a textarea?

vertical alignment top? Of which?
Jitendra PatilSr.Software EngineerCommented:
try the code below.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="TestWebApplication.Test" %>
<!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">
    <form id="form1" runat="server">
    <asp:Panel ID="PnlTest" runat="server" Width="100%">

Open in new window

.cs code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data; 
namespace TestWebApplication
    public partial class Test : System.Web.UI.Page

        protected void Page_Load(object sender, EventArgs e)
            if (!Page.IsPostBack)
                TextBox Txt = new TextBox();
                Txt.TextMode = TextBoxMode.MultiLine;
                Txt.Columns = 10;
                Txt.Rows = 10; 
                Txt.Text = "I am new textbox";

Open in new window

hope this helps.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now