我在gridview的GridViewRow
事件中动态创建RowCreated
,我需要在按钮点击时单独展开/折叠此特定行。
GridViewRow HeaderGridRow1 = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
TableCell HeaderCell1 = new TableCell();
TableCell HeaderCellEC = new TableCell();
ImageButton imgEC = new ImageButton();
imgEC.ImageUrl = "Images.png";
imgEC.ID = "imgShowHide";
imgEC.Click += ImgShowHide_Click;
HeaderCellEC.Controls.Add(imgEC);
HeaderGridRow1.Cells.Add(HeaderCellEC);
HeaderCell1.Text = "Info";
HeaderGridRow1.Cells.Add(HeaderCell1);
GridView1.Controls[0].Controls.AddAt(1, HeaderGridRow1);
代码背后:
private void ImgShowHide_Click(object sender, ImageClickEventArgs e)
{
}
现在在ImgShowHide_Click
事件中,我需要在HeaderGridRow1
上执行展开/折叠。由于它的动态控制我怎样才能实现它。
答案 0 :(得分:0)
ASP.Net Ajax控件工具包提供了Accordion窗格来实现Row Collapse和Expand功能。手风琴的工作演示可在https://ajaxcontroltoolkit.devexpress.com/Accordion/Accordion.aspx
获得本文http://www.c-sharpcorner.com/uploadfile/cd3aa3/database-binding-with-accordion-control/可能会帮助您在项目中实施代码