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
Expand|Select|Wrap|Line Numbers
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- DataRowView drv = (DataRowView)e.Row.DataItem;
- if (tmpCategoryName != 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, DataControlRowType.DataRow, DataControlRowState.Normal);
- TableCell cell = new TableCell();
- // Span the row across all of the columns in the Gridview
- cell.ColumnSpan = this.GdProd.Columns.Count;
- cell.Width = Unit.Percentage(100);
- cell.Style.Add("font-weight", "bold");
- cell.Style.Add("background-color", "#c0c0c0");
- cell.Style.Add("color", "white");
- HtmlGenericControl span = new HtmlGenericControl("span");
- span.InnerHtml = tmpCategoryName;
- cell.Controls.Add(span);
- row.Cells.Add(cell);
- tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
- }
- }
- }
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