views:

32

answers:

1

I have created a tabs using div tag in javascript. I have asp.net button on each tab. whenever I clicked on button the focus is set to first tab.

I am using following code in page load event.

HtmlGenericControl content_1 = new HtmlGenericControl("content_1");
HtmlGenericControl content_2 = new HtmlGenericControl("content_2");
HtmlGenericControl content_3 = new HtmlGenericControl("content_3");
HtmlGenericControl content_4 = new HtmlGenericControl("content_4");
HtmlGenericControl content_5 = new HtmlGenericControl("content_5");

HtmlGenericControl selectedPage = new HtmlGenericControl(pageName);
content_1.Style["display"] = "none";
content_2.Style["display"] = "none";
content_3.Style["display"] = "none";
content_4.Style["display"] = "none";
content_5.Style["display"] = "none";

selectedPage.Style["display"] = "block";
selectedPage.Attributes.CssStyle.Add("class", "active");
A: 

each div will have unique id.

on clicking div tab, you will get the id of the div.

Using css style add class active to that div.

Add inactive class to other divs.

When you click another div , remove active class from this and add class to cliked one

zod
what is this, pseudocode? come on dude, show code. (as simple as it may be). dont be lazy. :)
RPM1984
let him do something. am sleepy now :)
zod
@RPM Don't be lazy? This is SO, where some of the laziest questions get asked. Zod's answer, though lacking in the English department, should be sufficient.
Justin Johnson
trying to make my english better !!. I used to type as we do in chat. Not the full sentence, but the reader can understand.
zod