Showing posts with label tab. Show all posts
Showing posts with label tab. Show all posts

Wednesday, March 28, 2012

Programatically Create Tab Container and Tab Panels

Hi,

How can I create a tab container and subsequent tab panels within it using C# in the code behind?

Any help would be much appreciated.

Hello,

You can you the PlaceHolder Control to add the TabContainer on the page, like so: make sure to add the reference at the top - using AjaxControlToolkit;

 TabContainer container =new TabContainer(); TabPanel panel1 =new TabPanel(); TabPanel panel2 =new TabPanel(); TextBox txtOne =new TextBox(); txtOne.ID ="txtOne"; txtOne.Text ="Example Text"; panel1.HeaderText ="This is Header 1 Text"; panel1.Controls.Add(txtOne); panel2.HeaderText =" This is Header 2 Text"; container.Tabs.Add(panel1); container.Tabs.Add(panel2); PlaceHolder1.Controls.Add(container);
 
Hope this helps. 

Yep that was perfect...thanks for this!

Programmatic refresh of a tab

I have been trawling the forums for a while and still have no solution to my problem. I have multiple tabs each contained within update panels. What i need is for a submit button in one tab to perform the partial update and then programatically update a second tab as well. Any ideas would be greatly appreciated.

ok i finally solved my own problem. I set the updatemode property of the updatepanel to "always". That means that even if another tab is doing an async callback the other tab is always refreshed

Hi i am looking for past one week for tabview form in asp.net 2.0 plz could you help me how to create. i have search i dont have server control in asp.net 2.0. i cant use in my company in AJAX. so, plz let me know as soon as possible.

Thanks

dilip


Hi i am looking for past one week for tabview form in asp.net 2.0 plz could you help me how to create. i have search i dont have server control in asp.net 2.0. i cant use in my company in AJAX. so, plz let me know as soon as possible.

Thanks

dilip


Set UpdateMode="Always" will slow down the page if you have a lots of data on it. If you have many tabs but only want to update one or two of them,why don't try something like:

protectedvoid GridView1_RowUpdated(object sender,GridViewUpdatedEventArgs e)

{

GridView1.DataBind();

GridView2.DataBind(); UpdatePanel2.Update();

}

Saturday, March 24, 2012

Question about referencing a tab panel in vb.net code-behind

This has probably already been answered, but I have searched through the Ajax forums looking for a clue on how to do this and haven't got one!Stick out tongue

To start from the beginning...I have a MasterPage that has my header and footer stuff - no issues there. In my content page I call buttons from the MasterPage (not really a problem either - I don't think) the problem is that the content page is a tabcontainer with 3 tabs. Depending on certain criteria the tab index needs to be changed programmatically in my VB.net on click of one of the buttons from the Master page (hence the Masterpage note) I don't know how to reference the tabpanel of the tabcontainer to set the index to 0 or 1 or 2 (depending on criteria) and don't know Ajax well enough to know how to call the tabpanel in VB.net...

Any help/suggestions would be MUCH appreciated! TIA,

Seehttp://forums.asp.net/p/1071804/1723878.aspx

-Damien


Thanks Damien :-)

I don't know a thing about JavaScript, but I'm not sure that this will for me - not that it won't work - it obviously does, but I need to know if this can be done in the code-behind for VB? There are a lot of things happening in the VB code behind where I have to meet certain creiteria to show one tab, certain criteria for another and then show results in the last tab. How do I do this in my VB code? TIA,


Coleen:

but I need to know if this can be done in the code-behind for VB

Yes, that was in that post, for example: TabContainerName.ActiveTabIndex = 1

-Damien


Sorry - I missed the response to me in that thread last night - thank you, that helped!

P.S. One thing I missed (I figured this out - duh!) but you must have animports AjaxControlToolkit statement in your VB code behind in order to declare the variable for the TabConainer, which is why I didn't understand how that worked before. Like I siad, I'm very new to AJAX! Thanks for all the help on this!


No problem; glad you solved your issue!

-Damien


Actually, I just ran into a little snafu...

You know how I said that the master page has all the buttons? Well the snafu is that the master page has all the buttons - so the code behind has to go in the master page button click; but how do I referrence the TabContainer on the content page from the Master page?


You can use FindControl. Check outhttp://msdn2.microsoft.com/en-us/library/486wc64h.aspx andhttp://www.west-wind.com/WebLog/posts/5127.aspx for more info.

-Damien


Thanks again Damien, I'm still working on it, but I think this will work. Thank you very much!