473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Add subheadings to a repeater control

1
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
Expand|Select|Wrap|Line Numbers
  1. if (e.Row.RowType == DataControlRowType.DataRow)
  2.         {
  3.             DataRowView drv = (DataRowView)e.Row.DataItem;
  4.  
  5.             if (tmpCategoryName != drv["q1option"].ToString())
  6.             {
  7.                 tmpCategoryName = drv["q1option"].ToString();
  8.  
  9.                 // Get a reference to the current row's Parent, which is the Gridview (which happens to be a table)
  10.                 Table tbl = e.Row.Parent as Table;
  11.  
  12.                 if (tbl != null)
  13.                 {
  14.                     GridViewRow row = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);
  15.  
  16.                     TableCell cell = new TableCell();
  17.  
  18.                     // Span the row across all of the columns in the Gridview
  19.                     cell.ColumnSpan = this.GdProd.Columns.Count;
  20.  
  21.                     cell.Width = Unit.Percentage(100);
  22.                     cell.Style.Add("font-weight", "bold");
  23.                     cell.Style.Add("background-color", "#c0c0c0");
  24.                     cell.Style.Add("color", "white");
  25.  
  26.  
  27.                     HtmlGenericControl span = new HtmlGenericControl("span");
  28.                     span.InnerHtml = tmpCategoryName;
  29.  
  30.                     cell.Controls.Add(span);
  31.  
  32.                     row.Cells.Add(cell);
  33.  
  34.                     tbl.Rows.AddAt(tbl.Rows.Count - 1, row);
  35.                 }
  36.             }
  37.         }
  38.  
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
Oct 21 '08 #1
1 1729
Frinavale
9,735 Expert Mod 8TB
What are the errors you are getting and what have you tried so far?
Please post any code snippets you think will help to explain your problem and remember to code tags when posting code.

-Frinny
Oct 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue...
3
by: WebMatrix | last post by:
I am struggling with implementing somewhat complicated UI web-control. I explored Repeater, but I am not sure if it's the best way to go. I am leaning towards writing my own custom control and...
1
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
3
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or...
12
by: =?Utf-8?B?Qi4gQ2hlcm5pY2s=?= | last post by:
I'm doing a web app in VB/Dot Net 2.0. I'm probably a bit rusty and I have no experience using the repeater control. I have a user control I've created with multiple properties. I've created a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.