Jesoba.com is launched, Click below image to access it

Jesoba.com is launched, Click below image to access it
Technology and Entertainment Blog

How to create function for Enable And Disable TextBox In ASP.Net Using C#

Title : Function for Enable And Disable TextBox Controle In ASP.Net Using C# .


Article :  ASP0001


Use Below Code in your Project :

Source Code :

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.HtmlControls;
using System.IO;


using System.Collections;
public partial class InitComp : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
      
        if (!Page.IsPostBack)
        {
           DisableControles();
        }
    }


public void EnableDisableTextBox(Boolean bl, params TextBox[] mobj)
    {
        int i;
        try
        {
            for (i = 0; i <= mobj.Length - 1; i++)
            {
               mobj[i].Enabled = bl;
            }
        }
        catch (System.Exception excep)
        {
            throw (excep);
        }
    }

 private void  DisableControles()
     {
        fun.EnableDisableTextBox(false, TextBox1, Textbox2, TextBox3 );    

     }
}

Google+ Badge

About Author

My photo

I am Senior Server Expert and Professional Blogger.