id0 is the class for the div that's got background as a sprite image and inside of this div..there's a list of links (in repeater)..when the user hovers over links..the background image of div displays diff parts of sprite image accordingly
Now I want that the classes id1 to id5 be set as the classes of the repeater's list...now how do I go abut it?
like the list of links inside of repeater is coming from the DB..how do I create div tags inside of this repeater
and how do I set the class for each of the 5 divs that will be created and set these classes on them ?
like earlier I had simple markup but now I have to generate that list of links using a repeater..so how do I apply the CSS now ??
Please give some ideas..thnx
[EDIT] ok tried this.. added div tag in repeater after label and in code behind :- rpt1.FindControl("myDiv").Controls.Add(class= ??) //what to type here use for loop or what ? [edit] this doesnt work..whats wrong ?**
for(int i=1;i<6;i++)
{
rpt1.FindControl("myDiv").Controls.Add("class=id[i]");
}
The above's giving the following error:-
The best overloaded method match for 'System.Web.UI.ControlCollection.Add(System.Web.UI.Control)' has some invalid arguments
Now how do I set classes for the divs?
pch..made dilly mistake..made changes ..
for (int i = 1; i < 6; i++)
{
string divClass = "id";
rpt1.FindControl("myDiv").Controls.Add("class=id" + i);
}
still the same error..
[edit]
tried the following..doesnt work
rpt1.FindControl("myDiv").Attributes.Add("class","id" +i);
[edit]
I tried the following now..
rpt1.FindControl("myDiv").Attributes["class"] = "id" + i;
it says "Cannot apply indexing with [] to an expression of type 'method group'" ???