Click here to Skip to main content
15,909,530 members
Home / Discussions / C#
   

C#

 
GeneralRe: Need to time stamp the last time a file was considered good. Pin
Lecutus121-May-09 4:17
Lecutus121-May-09 4:17 
Answerread my sig! Pin
Luc Pattyn20-May-09 12:35
sitebuilderLuc Pattyn20-May-09 12:35 
GeneralRe: read my sig! Pin
Lecutus121-May-09 4:16
Lecutus121-May-09 4:16 
GeneralRe: read my sig! Pin
Luc Pattyn21-May-09 4:26
sitebuilderLuc Pattyn21-May-09 4:26 
AnswerRe: Need to time stamp the last time a file was considered good. Pin
Luc Pattyn21-May-09 4:36
sitebuilderLuc Pattyn21-May-09 4:36 
GeneralRe: Need to time stamp the last time a file was considered good. Pin
Lecutus122-May-09 3:34
Lecutus122-May-09 3:34 
QuestionLeftover Cache? Pin
gmhanna20-May-09 10:10
gmhanna20-May-09 10:10 
QuestionProblem in datagridtextbox column Pin
Shuaib wasif khan20-May-09 8:22
Shuaib wasif khan20-May-09 8:22 
hell sir,
i am working on datagrid control in c# window application
i use datagridtextbox in datagrid . my probblem is that how can i do datagrid textbox column enable=false if it contains data =sunday

my code is...
try
{
dataGrid1.DataSource=null;
dt.Clear();
dataGrid1.TableStyles.Clear();
ad=new SqlDataAdapter("select * from attendance where months='"+txtmonth.Text+"' and class='"+txtcurrentclass.Text+"' and section='"+txtsection.Text+"' and session='"+Class1.session+"'",cn);
ad.Fill(dt);
dt.Tables[0].DefaultView.AllowNew=false;
dataGrid1.DataSource=dt.Tables[0];

DataGridTableStyle tbl=new DataGridTableStyle();
tbl.MappingName=dt.Tables[0].TableName;

DataGridTextBoxColumn txt=new DataGridTextBoxColumn();
// txt.MappingName=dt.Tables[0].Columns["id"].ColumnName;
// txt.HeaderText="SNo.";
// txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
// txt.TextBox.Enabled=false;
// txt.ReadOnly=true;
// txt.Width=45;
// txt.TextBox.BackColor=Color.Salmon;
// txt.NullText="0";
//
// tbl.GridColumnStyles.Add(txt);
//
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns["Studentcode"].ColumnName;
txt.HeaderText="Student Code";
txt.ReadOnly=true;txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.TextBox.BackColor=Color.Salmon;
txt.TextBox.Enabled=false;
txt.TextBox.WordWrap=true;
txt.Width=160;

txt.Alignment=HorizontalAlignment.Left;


tbl.GridColumnStyles.Add(txt);

//
txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns["studentname"].ColumnName;
txt.HeaderText="Name";
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
txt.TextBox.Enabled=false;
txt.TextBox.BackColor=Color.Salmon;
txt.TextBox.ForeColor=Color.Blue;
txt.ReadOnly=true;
txt.Width=80;
txt.Alignment=HorizontalAlignment.Center;
tbl.GridColumnStyles.Add(txt);


txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[4].ColumnName;
txt.HeaderText="1 "+txtmonth.Text;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.Alignment=HorizontalAlignment.Center;
txt.Width=65;
if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{

txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);

txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[5].ColumnName;
txt.HeaderText="2 "+txtmonth.Text;
txt.Width=47;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;
txt.Alignment=HorizontalAlignment.Center;
if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{

txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);



txt=new DataGridTextBoxColumn();
txt.MappingName=dt.Tables[0].Columns[6].ColumnName;
txt.HeaderText="3 "+txtmonth.Text ;
txt.Width=47;
txt.TextBox.BorderStyle=BorderStyle.FixedSingle;txt.Alignment=HorizontalAlignment.Center;

if(txt.TextBox.Text==DayOfWeek.Sunday.ToString())
{
txt.ReadOnly=true;
txt.TextBox.BackColor=Color.Red;
}
else
{

txt.ReadOnly=false;
txt.TextBox.BackColor=Color.White;
}
tbl.GridColumnStyles.Add(txt);
//class1
txt=new DataGridTextBoxColumn();

tbl.GridColumnStyles.Add(txt);
dataGrid1.TableStyles.Add(tbl);


my problem is that i want to make textbox readonly in txt.Textbox contains data=sunday and when i scroll data datagrid first three columns do not scroll except else.
please help me ..
Sleepy | :zzz:
AnswerRe: Problem in datagridtextbox column Pin
Henry Minute21-May-09 0:14
Henry Minute21-May-09 0:14 
QuestionAdd-In Pin
su_penguin20-May-09 6:24
su_penguin20-May-09 6:24 
AnswerRe: Add-In Pin
molesworth20-May-09 6:36
molesworth20-May-09 6:36 
GeneralRe: Add-In Pin
su_penguin20-May-09 7:07
su_penguin20-May-09 7:07 
GeneralRe: Add-In Pin
molesworth20-May-09 9:31
molesworth20-May-09 9:31 
QuestionDataBinding in ComboBox Pin
LiranViper20-May-09 6:20
LiranViper20-May-09 6:20 
AnswerRe: DataBinding in ComboBox Pin
Ian McCaul20-May-09 6:46
Ian McCaul20-May-09 6:46 
GeneralRe: DataBinding in ComboBox Pin
LiranViper20-May-09 22:37
LiranViper20-May-09 22:37 
Questiontreeview checkboxes Pin
ehsan salehi20-May-09 6:04
ehsan salehi20-May-09 6:04 
Questionremoting annoying Exception {"Found two different objects associated with the same URI, '/999013af_72e3_42b1_affa_43766d7f541f/Chat'."} [modified] Pin
michael@cohen20-May-09 5:57
michael@cohen20-May-09 5:57 
QuestionCrazy error Pin
Jonathan Harker20-May-09 5:31
Jonathan Harker20-May-09 5:31 
AnswerRe: Crazy error Pin
molesworth20-May-09 5:51
molesworth20-May-09 5:51 
AnswerRe: Crazy error Pin
DavidRRR20-May-09 5:54
DavidRRR20-May-09 5:54 
AnswerRe: Crazy error Pin
Dave Kreskowiak20-May-09 6:03
mveDave Kreskowiak20-May-09 6:03 
GeneralRe: Crazy error Pin
Jonathan Harker20-May-09 7:50
Jonathan Harker20-May-09 7:50 
GeneralRe: Crazy error Pin
Christian Graus20-May-09 8:00
protectorChristian Graus20-May-09 8:00 
QuestionConfig File Confusion Pin
BrianAshcroft20-May-09 4:42
BrianAshcroft20-May-09 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.