Monday, March 26, 2012

Tab Control - create tab on gridview selectindexchanged - code posted

I am using ajax tab control. I want to create a new tab everytime i click on the select of the gridview. Problem is it only allows me to create 1 tab. When I click on another select in the gridview - it doesn't allow to create another tab and gives me an error.

Is there another way to do this?

protectedvoid gv1_SelectedIndexChanged(object sender,EventArgs e)

{

UserControl ucR = (UserControl)LoadControl("../test.ascx");

ucR.ID = ((GridView)sender).SelectedDataKey.Value.ToString();

TabPanel tab =newTabPanel();

tab.Controls.Add(ucR);

tab.HeaderText = ((GridView)sender).SelectedDataKey.Value.ToString();

tcResults.Tabs.Add(tab);

}

After postback it loses the tabs - had to load in session and re-make the tabs in page_init


What error you are getting ?

No comments:

Post a Comment