.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Text align using textbox

Posted By:laptop charles       Posted Date: March 24, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

Using textbox and three buttons to align the inside the textbox like Center and right and also left align.

It has using three buttons and one textbox with multiple line true.
Using Style text align like left and right and center align.

Aspx coding:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    Untitled Page
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e)

    protected void Center_Click(object sender, EventArgs e)
        TextBox1.Style["text-align"] = "center";

    protected void Right_Click(object sender, EventArgs e)
        TextBox1.Style["text-align"] = "right";

    protected void Left_Click(object sender, EventArgs e)
        TextBox1.Style["text-align"] = "left";



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend