【发布时间】:2011-09-02 15:48:21
【问题描述】:
我想在后面的代码中将 gridview 与数据表绑定,我想在 gridview 的每个单元格中添加标签并在其值的标签上显示工具提示...我没有得到工具提示.. (我想展示那个舞台的每个座位)!并想提示它,还有我的舞台 可能会改变,所以我想要动态)
帮帮我..我的代码在这里
//网格视图在页面加载时绑定 它给了我索引超出范围。必须是非负数且小于集合的大小。参数名称:索引
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
for (int i = 0; i < table.Rows.Count; i++)
{
for (int j = 0; j < table.Columns.Count; j++)
{
Label lbl = new Label();
lbl.Text = GridView1.DataKeys[e.Row.RowIndex]["LabelText"].ToString();
lbl.ToolTip = GridView1.DataKeys[e.Row.RowIndex]["TooltipText"].ToString();
e.Row.Cells[0].Controls.Add(lbl);
}
}
}
【问题讨论】: