我有一个基于两个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);
}
}
答案 0 :(得分:0)
在此处查看如何使用RadGrid单元格:http://demos.telerik.com/aspnet-ajax/grid/examples/client/cellselection/defaultcs.aspx 了解如何在此处从RadWindow内部调用主页上的函数:http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx,以便传递新颜色。或者使用RadWindow的ContentTemplate,以便在相同的上下文中使用颜色选择器:http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html。 例如,存储对全局JS var中最后单击的单元格的引用。这也可以通过标准控件完成,您需要从事件的目标中提取单击的单元格。