我正在开发显示学生出勤率的 ASPxGridView。为此,我通过 sqlqry 过滤 1600 名学生中的 60 名学生。网格控件是在设计环境中创建的,有两列 RollNo 和 Name 以及两列模板列(即 ASPxCombobox 用于出席状态和 ASPxTextBox 用于备注。设计窗口代码如下所示。
[HTML]
<dx:ASPxGridView ID="dxgrd_StudentAttendance" runat="server" Theme="Glass" Width="800px" AutoGenerateColumns="False" onprocesscolumnautofilter="dxgrd_StudentAttendance_ProcessColumnAutoFilter">
<Columns>
<dx:GridViewDataTextColumn FieldName="roll_no" VisibleIndex="1" Caption="Roll No" Width="70px">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Name" VisibleIndex="2" Caption="Name of the Student" Width="300px">
</dx:GridViewDataTextColumn>
<dx:GridViewDataColumn FieldName="Attendance" VisibleIndex="3" Caption="Attendance Status" Width="100px">
<DataItemTemplate>
<dx:ASPxComboBox ID="dxcb_AttStatus" runat="server" ValueType="System.String" Theme="Glass" Width ="100px">
<Items>
<dx:ListEditItem Text="Present" Value="P" Selected ="true" />
<dx:ListEditItem Text="Absent" Value="A" />
<dx:ListEditItem Text="Leave" Value="L" />
<dx:ListEditItem Text="OnDuty" Value="O" />
</Items>
</dx:ASPxComboBox>
</DataItemTemplate>
</dx:GridViewDataColumn>
<dx:GridViewDataColumn FieldName="Remarks" VisibleIndex="4" Caption="Remarks" Width="230px">
<DataItemTemplate>
<dx:ASPxTextBox ID="dxtxt_Remarks" runat="server" ValueType="System.String" Theme="Glass" Width="230px"/>
</DataItemTemplate>
</dx:GridViewDataColumn>
</Columns>
<Settings ShowFilterRow="True" />
<SettingsBehavior AllowFocusedRow="True" />
<SettingsPager
NumericButtonCount="90"
PageSize="90"
RenderMode="Lightweight">
</SettingsPager>
<Settings ShowFooter="True" />
<Styles>
<Header HorizontalAlign="Center">
</Header>
</Styles>
<TotalSummary>
<dx:ASPxSummaryItem
FieldName="Name"
SummaryType="Count" ShowInColumn="Name"/>
</TotalSummary>
</dx:ASPxGridView>
在 C# 代码窗口中,在代码窗口中配置和输入的数据库如下所示
[C#代码]
SqlDataSource sqlds_StudentAttendanceSection = new SqlDataSource();
SqlDataSource sqlds_StudentAttendanceDept = new SqlDataSource();
sqlds_StudentAttendanceSection.SelectCommand = String.Format("Select b.roll_no, b.Name from tbl_AcademicYear a, tbl_Student_Master b, tbl_Dept_Master c," +
" tbl_Semester_Master d, tbl_Subject_Master e, tbl_Subject_Dept_Assigned f, tbl_Scheme_master g" +
" where a.AcademicYear=b.AcademicYear and b.Dept_Code=c.Dept_Code and d.Semester_ID=f.semester_id" +
" and e.Sub_Code=f.Sub_Code and c.Dept_Code = f.dept_code and g.Sch_Code=a.Sch_Code and" +
" e.Sub_Code='{0}'and a.AcademicYear='{1}'and c.Dept_Code='{0}'order by b.Roll_No",
dxcbSubject.Value,
dxcbAcademicYear.Text,
dxcbDepartment.Value);
sqlds_StudentAttendanceDept.ConnectionString = frmAttendance.strCon;
dxgrd_StudentAttendance.DataSource = sqlds_StudentAttendanceDept;
dxgrd_StudentAttendance.DataBind();
问题是,在没有模板控制的情况下在 aspxgridview 中显示数据所花费的时间是可以接受的(比如 1 或 2 秒)。但是使用模板控件,在 aspxgridview 中显示数据所需的时间约为 15 到 20 秒(这是不可接受的)。提供的任何帮助或建议将对我有很大帮助。
谢谢