Hi ,
i want to add subheadings to a repeater based on the categories.
I am able to do this on gridview control but not in arepeater.
this is the code used in girdview
[code=cpp]
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
DataRowView drv = (DataRowView)e. Row.DataItem;
if (tmpCategoryNam e != drv["q1option"].ToString())
{
tmpCategoryName = drv["q1option"].ToString();
// Get a reference to the current row's Parent, which is the Gridview (which happens to be a table)
Table tbl = e.Row.Parent as Table;
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowT ype.DataRow, DataControlRowS tate.Normal);
TableCell cell = new TableCell();
// Span the row across all of the columns in the Gridview
cell.ColumnSpan = this.GdProd.Col umns.Count;
cell.Width = Unit.Percentage (100);
cell.Style.Add( "font-weight", "bold");
cell.Style.Add( "background-color", "#c0c0c0");
cell.Style.Add( "color", "white");
HtmlGenericCont rol span = new HtmlGenericCont rol("span");
span.InnerHtml = tmpCategoryName ;
cell.Controls.A dd(span);
row.Cells.Add(c ell);
tbl.Rows.AddAt( tbl.Rows.Count - 1, row);
}
}
}
[/code]
i tried to add these codes under the onitemdatabound event of repeater but i t shows some errors.
Can any please help me to rewrite this code so that i can uses it.
i am new to asp.net ...please i am running out of time...please
i want to add subheadings to a repeater based on the categories.
I am able to do this on gridview control but not in arepeater.
this is the code used in girdview
[code=cpp]
if (e.Row.RowType == DataControlRowT ype.DataRow)
{
DataRowView drv = (DataRowView)e. Row.DataItem;
if (tmpCategoryNam e != drv["q1option"].ToString())
{
tmpCategoryName = drv["q1option"].ToString();
// Get a reference to the current row's Parent, which is the Gridview (which happens to be a table)
Table tbl = e.Row.Parent as Table;
if (tbl != null)
{
GridViewRow row = new GridViewRow(-1, -1, DataControlRowT ype.DataRow, DataControlRowS tate.Normal);
TableCell cell = new TableCell();
// Span the row across all of the columns in the Gridview
cell.ColumnSpan = this.GdProd.Col umns.Count;
cell.Width = Unit.Percentage (100);
cell.Style.Add( "font-weight", "bold");
cell.Style.Add( "background-color", "#c0c0c0");
cell.Style.Add( "color", "white");
HtmlGenericCont rol span = new HtmlGenericCont rol("span");
span.InnerHtml = tmpCategoryName ;
cell.Controls.A dd(span);
row.Cells.Add(c ell);
tbl.Rows.AddAt( tbl.Rows.Count - 1, row);
}
}
}
[/code]
i tried to add these codes under the onitemdatabound event of repeater but i t shows some errors.
Can any please help me to rewrite this code so that i can uses it.
i am new to asp.net ...please i am running out of time...please
Comment