我正在将一堆代码从 vb.net 转换为 c#,但我不太了解 vb.net,所以我遇到了很多问题。
有人可以帮我看看这里有什么问题吗?
protected void GenerateSalaryPunchesTable()
{
this.dgvPunchs.Rows.Clear();
string[] DateRange = this.cboPayPeriods.SelectedItem.Text.ToString().Replace(" ", "").Split('-');
while (Convert.ToDateTime(DateRange[0]) <= Convert.ToDateTime(DateRange[1]))
{
if (Convert.ToDateTime(DateRange[0]).DayOfWeek != DayOfWeek.Saturday & Convert.ToDateTime(DateRange[0]).DayOfWeek != DayOfWeek.Sunday)
{
Infragistics.WebUI.UltraWebGrid.UltraGridRow nRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow();
nRow.Cells.Add();
// Date Cell
nRow.Cells.Add();
// Worked CB
nRow.Cells.Add();
// Vacation CB
nRow.Cells.Add();
// Sick CB
nRow.Cells.Add();
// Holiday CB
nRow.Cells.Add();
// Error
nRow.Key = Convert.ToDateTime(DateRange[0].ToString()).ToShortDateString();
nRow.Cells[0].Value = Convert.ToDateTime(DateRange[0].ToString()).ToShortDateString();
nRow.Cells[1].Value = 0;
nRow.Cells[2].Value = 0;
nRow.Cells[3].Value = 0;
nRow.Cells[4].Value = 0;
nRow.Cells[5].Value = "";
this.dgvPunchs.Rows.Add(nRow);
}
DateRange[0] = Convert.ToDateTime(DateRange[0]).AddDays(1);
}
}
这是它给我的错误:
错误 4 'Infragistics.Web.UI.GridControls.ControlDataRecordCollection.Add(Infragistics.Web.UI.GridControls.ControlDataRecord)' 的最佳重载方法匹配有一些无效参数
错误 5 参数 1:无法从 'Infragistics.WebUI.UltraWebGrid 转换.UltraGridRow' 到 'Infragistics.Web.UI.GridControls.ControlDataRecord'
这是控制:
<ig:WebDataGrid ID="dgvPunchs" runat="server" Height="350px" Width="400px">
</ig:WebDataGrid>
它是从 VB.net 和旧版本的 Infragistics 转换而来的。到目前为止,我无法弄清楚这一点。
编辑:
我试过这个,它也没有工作......
Infragistics.Web.UI.GridControls.ControlDataRecord nRow =
Infragistics.Web.UI.GridControls.ControlDataRecord();
//Infragistics.WebUI.UltraWebGrid.UltraGridRow nRow = new Infragistics.WebUI.UltraWebGrid.UltraGridRow();