Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi i have the following codes which will make the controls to be displayed according to different value. For example, if it is Weekly, the following controls would be displayed but it is not shown as accordingly. Any help would be appreciated.

C#
if (this.TotalWorkingHoursSetups.AccumulateTotalHoursBy == StringEnum.GetStringValue(AccumulateTotalHoursBy.Weekly))
                {
                    this.WeekStartFromControl(true);
      
                }

//here are all the controls  
//only lblWeekStartFrom and cboWeekStartFrom is shown, the rest not      
private void WeekStartFromControl(bool enable)
        {
            this.lblWeekStartFrom.ClientVisible = enable;
            this.cboWeekStartFrom.ClientVisible = enable;
            this.lblMinimumDayOff.ClientVisible = enable;
            this.spnMinimumDayOff.ClientVisible = enable;
            this.lblRestDayType.ClientVisible = enable;
            this.chkFlexiHoliday.ClientVisible = enable;
            this.chkFlexiOffDay.ClientVisible = enable;
            this.chkFlexiRestDay.ClientVisible = enable;
            this.chkFlexiShutdownDay.ClientVisible = enable;
        }
Posted
Comments
Aravindba 6-Mar-14 1:23am    
hi what u get in enable parameter ? use break point and check enable parameter and change parameter name "enable" to enables or check or flag,bcz enable also one of the control property.
Jamie888 6-Mar-14 1:32am    
the enable will either return true or false, from the above codes "this.WeekStartFromControl(true);", i have returned "true", therefore the enable would be set to true, the controls should be displayed as it is true, but the weird thing is only the first two controls are displayed.
Aravindba 6-Mar-14 1:36am    
try to change parameter name. or use if condition
if (enable='True')then
{
this.lblWeekStartFrom.ClientVisible = True;
this.cboWeekStartFrom.ClientVisible = True;
..........
.....
...
}
else
{
this.lblWeekStartFrom.ClientVisible = False;
this.cboWeekStartFrom.ClientVisible = False;
.........
.............
..........

}
Jamie888 6-Mar-14 1:51am    
i have tried but the result is the same
Aravindba 6-Mar-14 2:01am    
in design u will give visible as false ? or in page load u will give visible as false for above listed controls ?

Hai

in design u will give visible as false ? or in page load u will give visible as false or in any other place u will give visible as false after code execute for above listed controls ?

regards
Aravind
 
Share this answer
 
C#
if (this.TotalWorkingHoursSetups.AccumulateTotalHoursBy == <pre lang="c#">StringEnum.GetStringValue(AccumulateTotalHoursBy.Weekly))
                {
                    this.WeekStartFromControl(true);
                    this.AllSetups(true);
      
                }
 
       private void WeekStartFromControl(bool enable)
        {
            this.lblWeekStartFrom.ClientVisible = enable;
            this.cboWeekStartFrom.ClientVisible = enable;
        }
        private void AllSetups(bool enable) 
        {
            this.lblMinimumDayOff.ClientVisible = enable;
            this.spnMinimumDayOff.ClientVisible = enable;
            this.lblRestDayType.ClientVisible = enable;
            this.chkFlexiHoliday.ClientVisible = enable;
            this.chkFlexiOffDay.ClientVisible = enable;
            this.chkFlexiRestDay.ClientVisible = enable;
            this.chkFlexiShutdownDay.ClientVisible = enable;
        }
 
Share this answer
 
v2

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