We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Selecting TabPageAdv after adding to TabControlAdv

Hi, I am adding Tabs to TabControlAdv and I want to select the new TabPage that is created on the fly, but TabControlAdv always sets focus on first TabPage. I tried using SelectedIndex, SelectedTab properties of TabControlAdv but none seems to work. I even tried page.Select() but that didn''t work either. Are there any other properties to select the page that gets created programmatically? Thanks

9 Replies

MJ Mano J Syncfusion Team September 20, 2005 05:37 AM UTC

Hi Taj, Please try the following to make focus to the dynamically created tab. TabPageAdv tabpage = new TabPageAdv(); tabpage.Text = "TabPage"; this.tabControlAdv1.TabPages.Add(tabpage); // To select the TabPage this.tabControlAdv1.SelectedTab = tabpage; Thanks for using Syncfusion products. Regards, Mano


TA Taj September 20, 2005 04:11 PM UTC

Hi Mano, As I said earlier, SelectedTab didn''t work for me. I noticed that after using this.tabControlAdv1.TabPages.Add(tabPage), nothing executes after that line. It happens only when I call a method to create tab asynchronously using a delegate. I have attached an example for your reference. (Syncfusion version: 3.0.1.0) Thanks >Hi Taj, > >Please try the following to make focus to the dynamically created tab. > >TabPageAdv tabpage = new TabPageAdv(); >tabpage.Text = "TabPage"; >this.tabControlAdv1.TabPages.Add(tabpage); > >// To select the TabPage this.tabControlAdv1.SelectedTab = tabpage; > >Thanks for using Syncfusion products. > >Regards, >Mano SyncTabEx_9519.zip


MJ Mano J Syncfusion Team September 21, 2005 04:03 AM UTC

Hi Jim, Please modify the code in the button click event as follows, private void button1_Click(object sender, System.EventArgs e) { if( this.createNewTabEvent != null ) { // this.createNewTabEvent.BeginInvoke(null,null); this.createNewTabEvent(); } } Please refer to the modified sample and let me know if this works for you. Thanks for using Syncfusion products. Regards, Mano Syncfusion, Inc. SyncTabEx_9975.zip


TA Taj September 21, 2005 06:54 AM UTC

Hi Mano, I know that the code works if the method is called directly or indirectly using a delegate, but my project requires me to make the call asyncronously and as you must have noticed the code never makes it beyond this line in my sample code. this.tabControlAdv1.Controls.Add( newTab ); I would like to know why does it not work with asyncronous calls. Thanks. >Hi Jim, > >Please modify the code in the button click event as follows, > >private void button1_Click(object sender, System.EventArgs e) >{ > if( this.createNewTabEvent != null ) > { > // this.createNewTabEvent.BeginInvoke(null,null); > this.createNewTabEvent(); > } >} > >Please refer to the modified sample and let me know if this works for you. > >Thanks for using Syncfusion products. > >Regards, >Mano >Syncfusion, Inc. > > > > >SyncTabEx_9975.zip > >


MJ Mano J Syncfusion Team September 21, 2005 09:56 AM UTC

Hi Taj, You could use the following coding to execute the delegate asynchronously, IAsyncResult result = BeginInvoke(new MethodInvoker(this.createNewTabEvent)); Please refer to the modified sample attached. Regards, Mano SyncTabEx_modified_2_865.zip


TA Taj September 21, 2005 05:23 PM UTC

Hi Mano, Lets say I want to pass some parameters to my method that is invoked asyncronously, then how would I address the problem. ("MethodInvoker" won''t work in that case.) for e.g. private delegate void CreateNewTabEvent( long listID ); -- Taj >Hi Taj, > >You could use the following coding to execute the delegate asynchronously, > >IAsyncResult result = BeginInvoke(new MethodInvoker(this.createNewTabEvent)); > >Please refer to the modified sample attached. > >Regards, >Mano > >SyncTabEx_modified_2_865.zip > >


AD Administrator Syncfusion Team September 23, 2005 09:01 PM UTC

Hi, Let me ask this for one more time, I am not looking for work around here. I would be pleased if somebody at Syncfusion can answer why TabPageAdv does not get selected in the sample I had send.


MJ Mano J Syncfusion Team September 27, 2005 11:06 AM UTC

Hi Taj, I apologize for the delay in responding. I am looking into this issue and will update this thread at the earliest. Thank you for your patience. Best regards, Mano


MJ Mano J Syncfusion Team September 27, 2005 04:31 PM UTC

Hi Taj, Please refer to the modified sample attached below. I have passed a parameter to the method called asynchronously. I have used BeginInvoke and EndInvoke method to invoke and ends the method respectively. Please refer to it and let me know if this meets your requirements. Thanks for using Syncfusion products. Regards, Mano TabControlAdv_Delegate

Loader.
Live Chat Icon For mobile
Up arrow icon