如何从其他类调用复选框?

时间:2015-07-09 15:49:18

标签: c# asp.net checkbox

我在一个名为TransportJobs.aspx的类中有一个文本框,在另一个名为CompanyDetails.aspx的类中有一个复选框。

chkJobsDocketRReq.Checked = Company.Current.GetModule("Jobs").DocketReq;

我想调用TransJobs类中的复选框,以便检查是否已勾选。

if(string.IsNullOrEmpty(txtDocketNo.Text))
        {
            if (chkJobsDocketRReq.Checked) //error
            {
                Valid = true;
            }
            else
            {
                Valid = false;
                txtDocketNo.Style.Add("background-color", "#FCF");
                txtDocketNo.Style.Add("background-image", "none");
                throw new FormatException("Docket No");
            }
        }

因为chkJobsDocketRReq属于另一个类,我怎么称呼它呢?

1 个答案:

答案 0 :(得分:0)

如果 CREATE TABLE #timesheet ([username] varchar(31), [local_date] datetime, [hours] numeric(6,2), [wday] varchar(31)) INSERT INTO #timesheet ([username], [local_date], [hours],[wday]) VALUES ('emilioh@thinkpowersolutions.com', '2015-05-24 19:00:00', 3.75 ,'Sun'), ('emilioh@thinkpowersolutions.com', '2015-05-25 19:00:00', 11 ,'Mon'), ('emilioh@thinkpowersolutions.com', '2015-05-26 19:00:00', 10.25,'Tue'), ('emilioh@thinkpowersolutions.com', '2015-05-27 19:00:00', 13 ,'Wed'), ('emilioh@thinkpowersolutions.com', '2015-05-28 19:00:00', 13 ,'Thu'), ('emilioh@thinkpowersolutions.com', '2015-05-29 19:00:00', 14 ,'Fri'), ('emilioh@thinkpowersolutions.com', '2015-05-30 19:00:00', 9 ,'Sat'), ('emilioh@thinkpowersolutions.com', '2015-05-31 19:00:00', 12 ,'Sun'), ('emilioh@thinkpowersolutions.com', '2015-06-01 19:00:00', 12.5 ,'Mon') select username , datepart(week,local_date) as Week , sum(hours) total , case when sum(case when DATENAME(dw, local_date) NOT IN ('Saturday', 'Sunday') then hours else 0 end) > 40 then 40 else sum(case when DATENAME(dw, local_date) NOT IN ('Saturday', 'Sunday') then hours else 0 end) end as RegHours , sum(case when DATENAME(dw, local_date) IN ('Saturday', 'Sunday') then hours else 0 end) + case when sum(case when DATENAME(dw, local_date) NOT IN ('Saturday', 'Sunday') then hours else 0 end) > 40 then sum(case when DATENAME(dw, local_date) NOT IN ('Saturday', 'Sunday') then hours else 0 end) - 40 else 0 end as OTHours from #timesheet group by username, datepart(week, local_date) DROP TABLE #timesheet username Week total RegHours OTHours emilioh@thinkpowersolutions.com 22 74.00 40.00 34.00 emilioh@thinkpowersolutions.com 23 24.50 12.50 12.00 是您网页上的控件,那么您可以使用FindControl访问它,假设所有内容都位于同一页面上

chkJobsDocketRReq