【发布时间】:2023-07-21 14:52:01
【问题描述】:
我有一个基于两个 Grid 值自动生成的表。
我希望能够选择每个单独的单元格(而不是多个单元格),并且在单元格选择时,应该出现 RadWindow。所选单元格的外框应变为粗体。 RadWindow 中有一个RadColor 选择器,选择的颜色将改变单元格的背景。
我在网上查看了一堆类似事件的示例,但由于我缺乏jQuery 和 JS 知识,我不确定如何去做。
我的桌子是这样的:
<asp:Table ID="Table1" runat="server" BorderStyle="Solid" BorderWidth="7px"
CellPadding="40" CellSpacing="15" Font-Bold="True" Font-Size="XX-Large"
GridLines="Both" HorizontalAlign = "Center">
</asp:Table>
表格生成的代码隐藏是:
public void Generate_Matrix()
{
// Total number of rows.
int rowCnt = CCT.Rows.Count;
// Current row count.
int rowCtr;
// Current cell counter
int cellCtr = 0;
// Total number of cells per row (columns).
int cellCnt = LCT.Rows.Count;
for (rowCtr = 1; rowCtr <= rowCnt; rowCtr++)
{
// Create new row and add it to the table.
TableRow tRow = new TableRow();
for (cellCtr = 1; cellCtr <= cellCnt; cellCtr++)
{
// Create a new cell and add it to the row.
TableCell tCell = new TableCell();
tCell.Text = rowCtr + "" + cellCtr;
tRow.Cells.Add(tCell);
}
Table1.Rows.Add(tRow);
}
}
【问题讨论】:
-
实际问题是什么?什么不工作?
-
我不确定如何实现这一点。实际上,我只需要知道如何创建一个选择单元格函数,其余的我可以自己解决。
标签: c# javascript asp.net select telerik