Click here to Skip to main content
15,918,624 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
i am doing a project which is window based.
in my datagridview i have five fields.
1.Volume of File 2.DateOfOpening 3.DateOfClosing 4.DateOfDestroy and 5.Status which is a combobox.
Within this combobox i have three items i.e Active,Closed and Destroyed.
when the user selects Active from the combobox,only the datetime picker of DateOfOpening should pop up and others should not pop up.
when user selects Destroy from the combobox,only datetime picker of DateOfClosing should pop Up and vice versa.
i have am opening the datetime picker but cant do with these conditions.this is my coding below:

C#
int _colIndex = e.ColumnIndex;
string _colName = null;
_colName = dgFileDetails.Columns[_colIndex].Name;
 CommonControls.IPicker objPicker = null;
 if (BlCommon.ValidateColumnFordate(_colName))
 {
 objPicker = new CommonControls.DatePicker();
 if (objPicker != null)
 {
 if (_colIndex == dgFileDetails.Columns[_colName].Index)
 {
 objPicker.ShowDialog();
 if (objPicker.Tag != null)
 {
 dgFileDetails[_colName, e.RowIndex].Value = objPicker.Tag;
 dgFileDetails[_colName, e.RowIndex].ReadOnly = true;
 }
 }
 }
}

public static bool ValidateColumnFordate(string columnName)
{
string temp = columnName.Substring(0, 4);
if (temp.ToLower() == "date")
return true;
else
return false;
}
Posted
Comments
RakeshMeena 17-Jun-11 0:26am    
What is the exact problem? Your control is not showing up or what?

1 solution

actually i just waked up and im littile confused!!
but in general you may have a good use of "enabled" property
you can disable or enable any control by setting it to false.
this is most easier way.
 
Share this answer
 

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