Click here to Skip to main content
15,908,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually i am using textbox1 in registration form, i am using same textbox while saving and as well as updating also. so i want the functionality like while saving it should be in write mode and while updating it should be in read only mode......is it possible

//code for submiting
C#
cmdAdmission.Parameters.Add(new SqlParameter("@created_on", SqlDbType.DateTime));
                cmdAdmission.Parameters["@created_on"].Value = txtDateofAdmission.Text;



//code for while editing
C#
txtDateofAdmission.Text = ds.Tables[0].Rows[0]["created_on"].ToString();
Posted
Updated 21-Feb-13 1:31am
v2

1 solution

txtDateofAdmission.ReadOnly=true;

txtDateofAdmission.ReadOnly=false;

use according to ur condition.
 
Share this answer
 
Comments
ntitish 21-Feb-13 8:03am    
how to chainge the colour of the text box of that particular textbox sir
[no name] 21-Feb-13 8:07am    
You can change color using
txtDateofAdmission.BackColor = Color.Aqua
Surendra0x2 21-Feb-13 8:06am    
Textbox Text color?
u mean text color?
Surendra0x2 21-Feb-13 8:09am    
like-
TextBox1.ForeColor = System.Drawing.Color.Green;
or backcolor
like
TextBox1.BackColor = System.Drawing.Color.Yellow;
use according to ur need.
if(some condition)
{
TextBox1.ForeColor = System.Drawing.Color.Green;
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900