I have WinTab with 6 tabs.
Each tab has it's own user control.
I do not want the user to be able to switch tabs unless the current tab is successfully validated. I do not see any server events to accomplish this.
Any suggestions on how to do this?
Hi,
There is no server option to do that. However, you may process and cancel event on client if fields are not field or have wrong values. Example:
<script type="text/javascript">function UltraWebTab1_BeforeSelectedTabChange(oWebTab, oTab, oEvent){ var oldTab = oWebTab.getSelectedTab(); if(oldTab.getIndex() == 0) { var text1 = oldTab.findControl("TextBox1"); var text2 = oldTab.findControl("TextBox2"); if(!text1 || !text2) { alert("can not find fields in tab 0"); return; } if(text1.value.length < 1 || text2.value.length < 1) { alert("Text1:" + text1.value + " text2:" + text2.value); oEvent.cancel = true; } } if(oldTab.getIndex() == 1) { var text3 = oldTab.findControl("TextBox3"); var text4 = oldTab.findControl("TextBox4"); if(!text3 || !text4) { alert("can not find fields in tab 1"); return; } if(text3.value.length < 1 || text4.value.length < 1) { alert("Text3:" + text3.value + " text4:" + text4.value); oEvent.cancel = true; } }}</script>
<igtab:UltraWebTab ID="UltraWebTab1" runat="server"> <ClientSideEvents BeforeSelectedTabChange="UltraWebTab1_BeforeSelectedTabChange" /> <Tabs> <igtab:Tab Text="New Tab"> <ContentTemplate> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> </ContentTemplate> </igtab:Tab> <igtab:Tab Text="New Tab"> <ContentTemplate> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> </ContentTemplate> </igtab:Tab> </Tabs></igtab:UltraWebTab>
Thank you Viktor the information was most helpful. I do have another question.
My aspx form is calling a user control.
<td class="center"> <uc1:SpellChecker ID="SpellChecker1" runat="server" /> </td>
I want to be able to validate in that tab that the user completed the information on this user control. How would I accompish this?
Contents of my user control is:
<igtxt:WebTextEdit ID="webtxtShortDesc" runat="server" Height="350px" Width="98%" BorderStyle="Ridge" BackColor="#CCFFFF" CssClass="center" > <BorderDetails StyleBottom="Ridge" StyleLeft="Ridge" StyleRight="Ridge" StyleTop="Ridge" /> </igtxt:WebTextEdit><input id="btnSpellCheck" runat="server" type="button" value="Check Spelling" /><ig_spell:WebSpellChecker ID="WebSpellChecker1" runat="server"></ig_spell:WebSpellChecker>
Thanks,
Jim