is it possible to switch tabs when the user interacts with another control outside of the tab? i.e. we have a web grid or hyperlinks or buttons. If the user hits one of these, we would like for the tab control to automatically switch to the corresponding tab to that control. Is this possible?
thank you,
You could make use of our Client Side Object Model and change the selected tab through JavaScript.
ultraTab.setSelectedIndex(1);
WebTab CSOM Overview:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebTab_CSOM.html
WebTab CSOM Members:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/WebTab_Object_CSOM.html
I have done this also,however I noticed this caused a postback on my page. Can I ensure this postback does not happen?, because if I just click on a tab with the mouse a postback does not seem to occur. David
By parameter, do you mean a query string?
If you are trying to do this on the code behind, based on your query string, select the appropriate tab in one of the page events.
It would be something like,
if(adding) then
ultratab.selectedtabindex=2
elseif(detail)
ultratab.selectedtabindex=0
end if
How can I do this through VB.NET code on the code behind side. I want to call the page with a parameter, and then switch to different tabs based on that parameter.
Example, if the user is adding a new record, it goes to detail screen and selects tab 3 for entering new data. If the user selects the detail screen from an existing record, it shows tab 1 for a summary or something else.
Thanks for the reply Sung. That is very useful indeed. I now have it working. I was missing the return keyword in the OnClientClick call for my asp.net button, and my javascript function did not have return false. Thanks for your help with this. Incidentally this subtle difference between using html and asp.net buttons is not defined in the example Client side events. David
It may depend on how you are calling your script? If you are clicking on a button, is it a html button or an asp.net button. If you are using an asp.net button, then that is what may be causing the postback.
Here's sample code for doing it for both types of buttons. Notice the return false for the method the asp.net button calls.
script:
ultraTab.setSelectedIndex(2);
}
{
<igtab:UltraWebTab ID="UltraWebTab1" runat="server" Height="279px" Width="410px">
<Tabs>
<igtab:Tab Text="First">
<ContentTemplate>
First Tab Content
</ContentTemplate>
</igtab:Tab>
<igtab:Tab Text="Second">
Second Tab Content
<igtab:Tab Text="Third">
Third Tab Content
</Tabs>
</igtab:UltraWebTab>
<asp:Button ID="Button1" runat="server" Text="Third Tab (asp button)" OnClientClick="return gotothirdtab()" />
<input id="Button2" type="button" value="Third Tab (html button)" onclick="return Button2_onclick()" />