This is a migrated thread and some comments may be shown as answers.

RadTabStrip with RadMultipage (user controls) save current page on tab click

3 Answers 360 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
ADT
Top achievements
Rank 1
ADT asked on 09 Jul 2013, 06:14 PM

Hello all and Thanks for any help in advance. I am using a main web page that holds a RadTabStrip with RadMultipage. Each page for the Multipage is a seperate user control. I am using RenderSelectedPageOnly for this. Currently I have the tabs working and loading the proper pages. An issue I am running into is that when a user is on the first tab and clicks on the second tab, I want to force a save of the first tab. Anyone have input on how I can accomplish this. I notice on the tab click for the second tab it does the validation but if the required fields are entered it goes to the next tab without saving.

Here is my main .aspx page

<%@ Page Title="" Language="VB" MasterPageFile="~/STAR.Master" AutoEventWireup="false" CodeFile="~/ARL/Add-Set.aspx.vb" Inherits="AddNewSet" %>
<%@ Register TagPrefix="ucAddSetSetInfo" TagName="SetInfo" Src="~/ARL/rpvSetInfo.ascx" %>
<%@ Register TagPrefix="ucAddSetAttributes" TagName="Attributes" Src="~/ARL/rpvAttributes.ascx" %>
<%@ Register TagPrefix="ucAddSetAnalysis" TagName="Analysis" Src="~/ARL/rpvAnalysis.ascx" %>
<%@ Register TagPrefix="ucAddSetCreate" TagName="Create" Src="~/ARL/rpvCreate.ascx" %>
<%@ Register TagPrefix="ucAddSetEditDescription" TagName="EditDescription" Src="~/ARL/rpvEditDescription.ascx" %>
<%@ Register TagPrefix="ucAddSetEditAttributes" TagName="EditAttributes" Src="~/ARL/rpvEditAttributes.ascx" %>
<%@ Register TagPrefix="ucAddSetLabels" TagName="Labels" Src="~/ARL/rpvLabels.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphBodyText" runat="Server">
<!--- Load the ARL StyleSheet --->
<link href="css/ARL.css" rel="stylesheet" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
function MatterTabSelecting(sender, eventArgs) {
$get("<%= previousTabHidden.ClientID%>").value = sender.get_selectedTab().get_text();
if (typeof (Page_ClientValidate) == 'function') {
Page_ClientValidate();
if (!Page_IsValid)
eventArgs.set_cancel(true);
}
return false;
}
</script>
</telerik:RadCodeBlock>
<asp:HiddenField ID="previousTabHidden" runat="Server" />
<input type="hidden" id="RadSampleTypeValue" name="RadSampleTypeValue" value="" />
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="rtsAddNewSet" >
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rtsAddNewSet" />
<telerik:AjaxUpdatedControl ControlID="rmpAddNewSet" LoadingPanelID="RadAjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="rmpAddNewSet">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="rmpAddNewSet" LoadingPanelID="RadAjaxLoadingPanel" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
<h1>
Add New Set</h1>
<div class="clear">
</div>
<telerik:RadTabStrip runat="server" ID="rtsAddNewSet" Orientation="HorizontalTop" OnClientTabSelecting="MatterTabSelecting" CausesValidation="true"
SelectedIndex="0" MultiPageID="rmpAddNewSet" Skin="STAR" EnableEmbeddedSkins="False" OnTabClick="rtsAddNewSet_TabClick" AutoPostBack="true" >
<Tabs>
<telerik:RadTab Text="Set Info" PageViewID="rpvSetInfo" >
</telerik:RadTab>
<telerik:RadTab Text="Attributes" PageViewID="rpvAttributes" >
</telerik:RadTab>
<telerik:RadTab Text="Analysis" PageViewID="rpvAnalysis" >
</telerik:RadTab>
<telerik:RadTab Text="Create" PageViewID="rpvCreate" Enabled="false" >
</telerik:RadTab>
<telerik:RadTab Text="Edit Description" PageViewID="rpvEditDescription" Enabled="false" >
</telerik:RadTab>
<telerik:RadTab Text="Edit Attributes" PageViewID="rpvEditAttributes" Enabled="false" >
</telerik:RadTab>
<telerik:RadTab Text="Labels" PageViewID="rpvLabels" Enabled="false" >
</telerik:RadTab>
</Tabs>
</telerik:RadTabStrip>
<telerik:RadMultiPage runat="server" Visible="true" ID="rmpAddNewSet" BorderColor="Black"
BorderStyle="Solid" BorderWidth="1px" SelectedIndex="0" RenderSelectedPageOnly="true"
Width="950px" >
<telerik:RadPageView ID="rpvSetInfo" runat="server">
<ucAddSetSetInfo:SetInfo ID="pageSetInfo" runat="server" />
</telerik:RadPageView>
<telerik:RadPageView ID="rpvAttributes" runat="server">
<ucAddSetAttributes:Attributes ID="pageAttributes" runat="server"/>
</telerik:RadPageView>
<telerik:RadPageView ID="rpvAnalysis" runat="server">
<ucAddSetAnalysis:Analysis ID="pageAnalysis" runat="server"/>
</telerik:RadPageView>
<telerik:RadPageView ID="rpvCreate" runat="server">
<ucAddSetCreate:Create ID="pageCreate" runat="server"/>
</telerik:RadPageView>
<telerik:RadPageView ID="rpvEditDescription" runat="server">
<ucAddSetEditDescription:EditDescription ID="pageEditDescription" runat="server"/>
</telerik:RadPageView>
<telerik:RadPageView ID="rpvEditAttributes" runat="server">
<ucAddSetEditAttributes:EditAttributes ID="pageEditAttributes" runat="server"/>
</telerik:RadPageView>
<telerik:RadPageView ID="rpvLabels" runat="server">
<ucAddSetLabels:Labels ID="pageLabels" runat="server"/>
</telerik:RadPageView>
</telerik:RadMultiPage>
<div class="clear">
</div>
</asp:Content>

Here is the back code for this main page:

Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.UI
Imports System.Configuration
Imports System.Diagnostics
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI.HtmlControls
Imports System.Xml
Imports Ionic.Zip
Partial Class AddNewSet
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 
    End Sub
    Protected Sub rtsAddNewSet_TabClick(sender As Object, e As Telerik.Web.UI.RadTabStripEventArgs)
        Dim strSelectedTab As String = e.Tab.PageViewID
        rmpAddNewSet.FindPageViewByID(strSelectedTab).Visible = True
        ' rmpAddNewSet.FindPageViewByID(strSelectedTab).
    End Sub
 
 
 
End Class

Here is my .ascx code for the first user control:

<%@ Control Language="VB" AutoEventWireup="false" CodeFile="rpvSetInfo.ascx.vb" Inherits="Set_Info" %>
<asp:HiddenField ID="previousTabHidden" runat="Server" />
<input type="hidden" id="RadSampleTypeValue" name="RadSampleTypeValue" value="" />
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        //Enforces maxlength of multiline textboxes
        function textboxMultilineMaxNumber(txt, maxLen) {
            try {
                if (txt.value.length > (maxLen - 1)) return false;
            } catch (e) {
            }
        }
 
    </script>
</telerik:RadCodeBlock>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManagerProxy ID="AjaxManagerProxy1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="cboFund" EventName="SelectedIndexChanged">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="txtFundTitle" />
                <telerik:AjaxUpdatedControl ControlID="txtFundManager" />
                <telerik:AjaxUpdatedControl ControlID="lblConfidential" />
                <telerik:AjaxUpdatedControl ControlID="rmpAddNewSet" LoadingPanelID="RadAjaxLoadingPanel2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnNext">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rtsAddNewSet" />
                <telerik:AjaxUpdatedControl ControlID="rmpAddNewSet"  />
                <telerik:AjaxUpdatedControl ControlID="lblErrors" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="btnSave">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="rtsAddNewSet" />
                <telerik:AjaxUpdatedControl ControlID="rmpAddNewSet" LoadingPanelID="RadAjaxLoadingPanel2" />
                <telerik:AjaxUpdatedControl ControlID="lblErrors" />
            </UpdatedControls>
        </telerik:AjaxSetting>
        <telerik:AjaxSetting AjaxControlID="grdResultsTo">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="grdResultsTo" LoadingPanelID="RadAjaxLoadingPanel2" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManagerProxy>
<!--- Begin Page Content --->
<div class="ARL_container">
    <div style="width: 50%;">
        <asp:Label ID="lblErrors" runat="server" ForeColor="Red" Visible="false" Text="1234"></asp:Label>
    </div>
    <table class="box-style">
        <tr>
            <td>
                <label>
                    Set #:</label>
            </td>
            <td>
                <asp:Label ID="lblSetNumber" runat="server"></asp:Label>
            </td>
            <td>
                <telerik:RadButton ID="btnGenerateSampleNum" runat="server" Text="Generate Sample"
                    Visible="false" CausesValidation="true" AutoPostBack="true">
                </telerik:RadButton>
            </td>
            <td colspan="2" align="right">
                Date Submitted:
            </td>
            <td>
                <telerik:RadDatePicker ID="rdpDateSubmitted" runat="server" DateInput-MaxLength="8">
                    <Calendar ID="Calendar2" runat="server">
                        <FastNavigationSettings EnableTodayButtonSelection="true">
                        </FastNavigationSettings>
                        <SpecialDays>
                            <telerik:RadCalendarDay Repeatable="Today" Date="" ItemStyle-CssClass="rcToday">
                            </telerik:RadCalendarDay>
                        </SpecialDays>
                    </Calendar>
                </telerik:RadDatePicker>
            </td>
        </tr>
        <tr>
            <td>
                Parent(s):
            </td>
            <td>
                <telerik:RadComboBox ID="cboParentOne" runat="server" DropDownWidth="220px" DataTextField="SampleNumber"
                    DataValueField="SampleID" EmptyMessage="Select..." Height="190px" MarkFirstMatch="true"
                    HighlightTemplatedItems="true" AllowCustomText="true" MaxLength="6" DataSourceID="GetSampleNumber"
                    EnableItemCaching="true" CausesValidation="false" AutoPostBack="false" EnableAutomaticLoadOnDemand="true"
                    ShowMoreResultsBox="true" ItemsPerRequest="20">
                    <HeaderTemplate>
                        <ul>
                            <li class="colSampleNum">Sample</li>
                            <li class="colSampleNum">Date Submitted</li>
                        </ul>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <ul>
                            <li class="colSampleNum">
                                <%#Eval("SampleNumber")%>
                            </li>
                            <li class="colSampleNum">
                                <%#Eval("DateSubmitted")%>
                            </li>
                        </ul>
                    </ItemTemplate>
                </telerik:RadComboBox>
            </td>
            <td>
                <telerik:RadComboBox ID="cboParentTwo" runat="server" DropDownWidth="220px" DataTextField="SampleNumber"
                    DataValueField="SampleID" EmptyMessage="Select..." Height="190px" MarkFirstMatch="true"
                    HighlightTemplatedItems="true" AllowCustomText="true" MaxLength="6" DataSourceID="GetSampleNumber"
                    EnableItemCaching="true" AutoPostBack="false" EnableAutomaticLoadOnDemand="true"
                    ShowMoreResultsBox="true" ItemsPerRequest="20">
                    <HeaderTemplate>
                        <ul>
                            <li class="colSampleNum">Sample</li>
                            <li class="colSampleNum">Date Submitted</li>
                        </ul>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <ul>
                            <li class="colSampleNum">
                                <%#Eval("SampleNumber")%>
                            </li>
                            <li class="colSampleNum">
                                <%#Eval("DateSubmitted")%>
                            </li>
                        </ul>
                    </ItemTemplate>
                </telerik:RadComboBox>
            </td>
            <td>
                <telerik:RadComboBox ID="cboParentThree" runat="server" DropDownWidth="220px" DataTextField="SampleNumber"
                    DataValueField="SampleID" EmptyMessage="Select..." Height="190px" MarkFirstMatch="true"
                    HighlightTemplatedItems="true" AllowCustomText="true" MaxLength="6" DataSourceID="GetSampleNumber"
                    EnableItemCaching="true" AutoPostBack="false" EnableAutomaticLoadOnDemand="true"
                    ShowMoreResultsBox="true" ItemsPerRequest="20">
                    <HeaderTemplate>
                        <ul>
                            <li class="colSampleNum">Sample</li>
                            <li class="colSampleNum">Date Submitted</li>
                        </ul>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <ul>
                            <li class="colSampleNum">
                                <%#Eval("SampleNumber")%>
                            </li>
                            <li class="colSampleNum">
                                <%#Eval("DateSubmitted")%>
                            </li>
                        </ul>
                    </ItemTemplate>
                </telerik:RadComboBox>
            </td>
            <td colspan="2">
                  
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <span class="asterisk">*</span><asp:Label ID="Label3" runat="server" Text="EERC Fund:"></asp:Label>
                <telerik:RadComboBox ID="cboFund" runat="server" DataKeyNames="DateSubmitted" MaxLength="6"
                    DropDownWidth="440px" DataTextField="Fund" DataValueField="FundID" Height="250px"
                    EmptyMessage="Select..." AutoPostBack="true" DataSourceID="sqlFundList" ValidationGroup="Group1"
                    OnSelectedIndexChanged="cboFund_SelectedIndexChanged" OnItemDataBound="cboFund_ItemDataBound"
                    MarkFirstMatch="true" AllowCustomText="true" EnableVirtualScrolling="true" HighlightTemplatedItems="true"
                    CausesValidation="false" EnableItemCaching="true" ShowMoreResultsBox="true" ItemsPerRequest="25" >
                    <HeaderTemplate>
                        <ul>
                            <li class="colFund">Fund</li>
                            <li class="colTitle">Title</li>
<%--                            <li class="colFundManager">Fund Manager</li>
                            <li class="colDate">Start Date</li>
                            <li class="colDate">End Date</li>--%>
                            <li class="colFundStatus" style="text-align: center">Fund Status</li>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <ul>
                            <li class="colFund">
                                <%# IIf(IsDBNull(Eval("Fund")), " ", Eval("Fund"))%>
                            </li>
                            <li class="colTitle">
                                <%#Eval("Title")%>
                            </li>
<%--                            <li class="colFundManager">
                                <%#Eval("PI")%>
                            </li>
                            <li class="colDate">
                                <%#Eval("StartDate")%>
                            </li>
                            <li class="colDate">
                                <%#Eval("EndDate")%>
                            </li>--%>
                            <li class="colFundStatus" style="text-align: center">
                                <%#Eval("FundStatus")%>
                            </li>
                        </ul>
                    </ItemTemplate>
                </telerik:RadComboBox>
                <asp:RequiredFieldValidator runat="server" ID="rfvFund" Display="None" ControlToValidate="cboFund"
                    ErrorMessage="Fund is required" ValidationGroup="SetInfo"  ></asp:RequiredFieldValidator>
            </td>
            <td colspan="2">
                <table width="100%">
                    <tr>
                        <td>
                            Title:
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtFundTitle" runat="server" ReadOnly="true" ReadOnlyStyle-ForeColor="GrayText"
                                Width="270px" TabIndex="-1">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                </table>
            </td>
            <td colspan="2">
                <table width="100%">
                    <tr>
                        <td>
                            Fund Manager:
                        </td>
                        <td>
                            <telerik:RadTextBox ID="txtFundManager" Width="170px" runat="server" ReadOnly="true"
                                ReadOnlyStyle-ForeColor="GrayText" TabIndex="-1">
                            </telerik:RadTextBox>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                Confidential/Restricted<br />
                <telerik:RadTextBox ID="txtConfidential" runat="server" Rows="2" TextMode="MultiLine"
                    Width="95%" MaxLength="200" EmptyMessage="Optional: Enter confidential comments here...">
                </telerik:RadTextBox>
            </td>
            <td colspan="3">
                <asp:Label ID="lblConfidential" runat="server" Text="" Font-Underline="true" Font-Bold="True"
                    ForeColor="Red"></asp:Label>
            </td>
        </tr>
        <tr>
            <td>
                Submitted By:
            </td>
            <td>
                <telerik:RadComboBox ID="cboSubmittedBy" AppendDataBoundItems="true" DataTextField="Personnel"
                    Height="200px" runat="server" DataValueField="PersonnelID" DataSourceID="SqlPersonnelName"
                    OnItemDataBound="cboAnalyst_ItemDataBound" EmptyMessage="Select..." DropDownWidth="200px"
                    AllowCustomText="true" Sort="Descending" MarkFirstMatch="true" ItemsPerRequest="20"
                    EnableVirtualScrolling="true" HighlightTemplatedItems="true">
                </telerik:RadComboBox>
            </td>
            <td colspan="2">
                <div style="float: left;">
                    Dispose To:</div>
                <div style="float: left; padding-left: 5px;">
                    <telerik:RadComboBox ID="cboDispose" AppendDataBoundItems="true" DataTextField="Personnel"
                        Height="200px" runat="server" DataValueField="PersonnelID" DataSourceID="SqlPersonnelName"
                        OnItemDataBound="cboAnalyst_ItemDataBound" EmptyMessage="Select..." DropDownWidth="200px"
                        AllowCustomText="true" CausesValidation="true" Sort="Descending" MarkFirstMatch="true"
                        ItemsPerRequest="20" EnableVirtualScrolling="true" HighlightTemplatedItems="true">
                    </telerik:RadComboBox>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <span class="asterisk">*</span>Sample Description<br />
                <telerik:RadTextBox ID="txtSampleDesc" runat="server" Width="95%" TextMode="MultiLine"
                    Rows="4" EmptyMessage="Required: Enter sample description here..." >
                </telerik:RadTextBox>
                <asp:RequiredFieldValidator runat="server" Display="None" ID="rfvSampleDescription" ControlToValidate="txtSampleDesc"
                    ErrorMessage="Sample Description is required" ValidationGroup="SetInfo" ></asp:RequiredFieldValidator>
            </td>
            <td valign="top" rowspan="2" colspan="3">
                <asp:Label ID="lblResultsTo" runat="server" Text="Results To"></asp:Label>
                <div style="padding-left: 10px">
                    <telerik:RadGrid ID="grdResultsTo" runat="server" AutoGenerateColumns="False" AllowAutomaticUpdates="true"
                        CellSpacing="0" DataSourceID="SqlResultsTo" Width="450px" OnItemInserted="grdResultsTo_ItemInserted"
                        GridLines="None" AllowAutomaticInserts="true" OnItemCommand="grdResultsTo_ItemCommand"
                        AllowAutomaticDeletes="true" Enabled="true" EditItemStyle-Wrap="False" Height="150px">
                        <MasterTableView DataSourceID="SqlResultsTo" ShowFooter="false" DataKeyNames="PersonnelID,SetNumber"
                            EditMode="InPlace" CommandItemDisplay="Top" AllowSorting="True" ShowHeader="false">
                            <CommandItemSettings ShowRefreshButton="false " />
                            <Columns>
                                <telerik:GridBoundColumn DataField="SetNumber" DataType="System.Int32" FilterControlAltText="Filter SetNumber column"
                                    HeaderText="SetNumber" UniqueName="SetNumber" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PersonnelID" DataType="System.Int32" FilterControlAltText="Filter PersonnelID column"
                                    HeaderText="PersonnelID" UniqueName="PersonnelID" Display="False">
                                </telerik:GridBoundColumn>
                                <telerik:GridTemplateColumn DataField="ResultsTo" FilterControlAltText="Filter FullName column"
                                    HeaderText="Results To" SortExpression="FullName" UniqueName="ResultsTo">
                                    <InsertItemTemplate>
                                        <telerik:RadComboBox runat="server" ID="cboResultsTo" AppendDataBoundItems="true"
                                            DataTextField="Personnel" Height="200px" DataValueField="PersonnelID" DataSourceID="SqlPersonnelName"
                                            OnItemDataBound="cboAnalyst_ItemDataBound" EmptyMessage="Select..." DropDownWidth="200px"
                                            Sort="Descending" MarkFirstMatch="true" ItemsPerRequest="20" EnableVirtualScrolling="true"
                                            SelectedValue='<%# Bind("PersonnelID") %>'>
                                        </telerik:RadComboBox>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <div>
                                            <%#Eval("FullName")%>
                                        </div>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>
                                <telerik:GridEditCommandColumn ButtonType="LinkButton" UniqueName="EditCommandColumn"
                                    Display="true" ItemStyle-Width="125px" ItemStyle-ForeColor="Blue">
                                </telerik:GridEditCommandColumn>
                                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
                                    ItemStyle-Width="35px" ItemStyle-ForeColor="Blue">
                                </telerik:GridButtonColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                        </MasterTableView>
                        <ClientSettings>
                            <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                        </ClientSettings>
                        <FilterMenu EnableImageSprites="False">
                        </FilterMenu>
                    </telerik:RadGrid>
                </div>
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <label>
                    Handling Considerations</label><br />
                <telerik:RadTextBox ID="txtHandling" runat="server" Rows="3" TextMode="MultiLine"
                    Width="95%" MaxLength="250" EmptyMessage="Optional: Enter handling considerations here..."
                    onkeypress="return textboxMultilineMaxNumber(this,250)">
                </telerik:RadTextBox>
                <br />
            </td>
        </tr>
    </table>
    <!--- End Sample Info Content --->
    <asp:ValidationSummary runat="server" ID="validationSummary" CssClass="validationSummary" />
    <br />
    <telerik:RadButton ID="btnSave" runat="server" Text="Save"></telerik:RadButton>
    <telerik:RadButton ID="btnNext" runat="server" Text="Next"></telerik:RadButton>
     
 
 
    <br />
    <div class="clear">
    </div>
    <div>
        <span class="asterisk">*</span>Required
        <br />
        <br />
    </div>
    <!--- Data sources --->
    <asp:SqlDataSource ID="sqlFundlistbyDate" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Get_Select_FundsforSample" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="rdpDateSubmitted" Name="DateSubmitted" PropertyName="SelectedDate" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlFundlist" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_AllFunds" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlFundListActive" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_ActiveFunds" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="GetSampleNumber" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_SampleComboBox" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlResultsTo" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        ProviderName="<%$ ConnectionStrings:STARConnectionString.ProviderName %>" OldValuesParameterFormatString="old_{0}"
        InsertCommand="USP_STAR_Insert_ARLResultsTo" InsertCommandType="StoredProcedure"
        SelectCommand="USP_STAR_GET_SELECT_ARLResultsTo" SelectCommandType="StoredProcedure"
        DeleteCommand="USP_STAR_Delete_ARLResultsTo" DeleteCommandType="StoredProcedure">
        <SelectParameters>
            <asp:SessionParameter Name="SetNumber" SessionField="SetNumber" />
        </SelectParameters>
        <InsertParameters>
            <asp:SessionParameter Name="SetNumber" SessionField="SetNumber" />
            <asp:Parameter Name="PersonnelID" />
        </InsertParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlResultsToComboBox" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Get_Select_ResultsToCombo" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:SessionParameter Name="SampleID" SessionField="SampleNumberSessionID" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlPersonnelName" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_PersonnelActive" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlGetSampleType" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_SampleType" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlSampleTypeAttributes" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Get_Select_SampleAttributesGrid" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:SessionParameter Name="SampleID" SessionField="SampleNumberSessionID" />
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlGetSampleSource" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_SampleSource" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlCoalName" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_CoalName" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sqlCoalRank" runat="server" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        SelectCommand="USP_STAR_Select_CoalRank" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource12" ConnectionString="<%$ ConnectionStrings:STARConnectionString %>"
        runat="server" />
</div>

and here is the ascx.vb code for the first user control:

'Imports FilteringTemplateColumns
Imports Telerik.Web.UI
Imports System.Web.UI.WebControls
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.UI
Imports System.Configuration
Imports System.Diagnostics
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI.HtmlControls
Imports System.Xml
Imports Ionic.Zip
Partial Class Set_Info
    Inherits System.Web.UI.UserControl
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        ''Fix Sample Info table for Firefox
        'If Page.Request.Browser.Browser = "Firefox" Then
 
        '    txtConfidential.Rows = 1
        '    txtSampleDesc.Rows = 3
        '    txtHandling.Rows = 2
        '    txtFundTitle.Width = 270
        '    grdResultsTo.Height = 155
        'Else
        '    txtConfidential.Rows = 2
        '    txtSampleDesc.Rows = 4
        '    txtHandling.Rows = 3
        'End If
 
 
        If (Not Page.IsPostBack) Then
            rdpDateSubmitted.MaxDate = DateTime.Today
            rdpDateSubmitted.SelectedDate = Now
 
            Dim newSetNumber As Integer
            'newSetNumber = 37
 
            Dim strConnection As String = ConfigurationManager.ConnectionStrings("STARConnectionString").ConnectionString
 
            Dim Connection As New SqlConnection(strConnection)
            Connection.Open()
 
 
            Using Command As New SqlCommand("USP_STAR_Insert_NewSetNumber", Connection)
                Command.CommandType = Data.CommandType.StoredProcedure
                newSetNumber = Command.ExecuteScalar
            End Using
            Session("SetNumber") = newSetNumber
            'lblErrors.Text = Session("SetNumber")
            'lblErrors.Visible = True
            lblSetNumber.Text = newSetNumber.ToString()
            'Connection.Close()
            grdResultsTo.Rebind()
 
 
        End If
 
 
 
    End Sub
 
 
    'Display only sample number in text of combobox
    Protected Sub cboParent_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)
        Dim item As RadComboBoxItem = DirectCast(e.Item, RadComboBoxItem)
        item.Text = DirectCast(e.Item.DataItem, DataRowView)("SampleNumber").ToString()
    End Sub
 
    'ComboBox drop down format for displaying Personnel Names
    Protected Sub cboAnalyst_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)
 
        Dim item As RadComboBoxItem = DirectCast(e.Item, RadComboBoxItem)
        item.Text = DirectCast(e.Item.DataItem, DataRowView)("Personnel").ToString()
 
    End Sub
 
    'Message to display on success or failure of ResultsTo Grid
    Protected Sub grdResultsTo_ItemInserted(source As Object, e As GridInsertedEventArgs)
 
        Try
            If e.Exception IsNot Nothing Then
 
 
                e.Item.OwnerTableView.IsItemInserted = False
 
                grdResultsTo.Rebind()
                If e.Exception.Message.Contains("NULL") Then
 
                    DisplayMessagegrdResultsTo("Null item is invalid to insert.")
 
                Else
 
                    DisplayMessagegrdResultsTo(e.Exception.Message)
 
                End If
                e.ExceptionHandled = True
 
 
 
            Else
 
            End If
 
        Catch ex As SqlException
 
        End Try
 
 
 
    End Sub
 
    Private Sub DisplayMessagegrdResultsTo(text As String)
        grdResultsTo.Controls.Add(New LiteralControl(String.Format("<span style='color:red'>{0}</span>", text)))
    End Sub
 
    'Make edit column visible for inserts, so that automatic insert/cancel links display.  Hide once insert is complete.
    Protected Sub grdResultsTo_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) Handles grdResultsTo.ItemCommand
        Dim editColumn As GridEditCommandColumn = e.Item.OwnerTableView.GetColumnSafe("EditCommandColumn")
        If (e.CommandName = RadGrid.InitInsertCommandName) Then
 
            If (e.Item.OwnerTableView.EditMode = GridEditMode.InPlace) Then
                editColumn.Display = True
 
            End If
 
 
        ElseIf (e.CommandName = RadGrid.EditCommandName Or e.CommandName = RadGrid.PerformInsertCommandName Or e.CommandName = RadGrid.CancelCommandName) Then
 
            editColumn.Display = False
 
 
 
        End If
    End Sub
 
    Protected Sub grdResultsTo_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles grdResultsTo.ItemCreated
 
 
        If (TypeOf e.Item Is GridDataInsertItem AndAlso e.Item.IsInEditMode) Then
 
 
        End If
 
    End Sub
 
    Protected Sub grdResultsTo_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles grdResultsTo.ItemDataBound
        If TypeOf e.Item Is GridDataInsertItem AndAlso e.Item.OwnerTableView.IsItemInserted Then
            grdResultsTo.MasterTableView.GetColumn("EditCommandColumn").Visible = True
            For Each dataItem As GridDataItem In grdResultsTo.MasterTableView.Items
                DirectCast(dataItem("EditCommandColumn").Controls(0), LinkButton).Visible = False
 
            Next
        Else
            grdResultsTo.MasterTableView.GetColumn("EditCommandColumn").Visible = False
        End If
    End Sub
 
    Protected Sub cboResultsTo_ItemDataBound(sender As Object, e As RadComboBoxItemEventArgs)
        Dim item As RadComboBoxItem = DirectCast(e.Item, RadComboBoxItem)
        item.Text = DirectCast(e.Item.DataItem, DataRowView)("FullName").ToString()
 
 
    End Sub
 
 
 
    Private Shared Function GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String
        If total <= 0 Then
            Return "No matches"
        End If
 
        Return [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total)
    End Function
 
    Protected Sub cboParentOne_ItemsRequested(ByVal o As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
        cboParentOne.DataSourceID = "SqlDataSource12"
        Dim selectcommand As String = "SELECT SampleID, SampleNumber, CONVERT(VARCHAR(10), Datesubmitted, 101) as DateSubmitted FROM tblST_Sample WHERE SampleNumber Like'" + e.Text + "%'" + "  ORDER BY SampleNumber ASC"
        SqlDataSource12.SelectCommand = selectcommand
 
        cboParentOne.DataTextField = "SampleNumber"
        cboParentOne.DataValueField = "SampleID"
        cboParentOne.DataBind()
 
    End Sub
 
    Protected Sub cboFund_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadComboBoxItemEventArgs) Handles cboFund.ItemDataBound
        Dim item As RadComboBoxItem = DirectCast(e.Item, RadComboBoxItem)
        item.Text = DirectCast(e.Item.DataItem, DataRowView)("Fund").ToString()
        item.Attributes.Add("Title", DirectCast(e.Item.DataItem, DataRowView)("Title").ToString())
        item.Attributes.Add("FundManager", DirectCast(e.Item.DataItem, DataRowView)("PI").ToString())
        item.Attributes.Add("Confidential", DirectCast(e.Item.DataItem, DataRowView)("Confidential").ToString())
    End Sub
 
    Protected Sub cboFund_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs) Handles cboFund.SelectedIndexChanged
        '        MsgBox("Test", vbOK, "This is a test")
        'lblErrors.Visible = "true"
        'lblErrors.Text = "test"
        If cboFund.SelectedValue <> "" Then
            txtFundTitle.Text = cboFund.SelectedItem.Attributes.Item("Title").ToString()
            txtFundManager.Text = cboFund.SelectedItem.Attributes.Item("FundManager").ToString()
            If cboFund.SelectedItem.Attributes.Item("Confidential").ToString() = "True" Then
                lblConfidential.Text = "Fund is Confidential"
            Else
                lblConfidential.Text = ""
            End If
        Else
            txtFundTitle.Text = ""
            txtFundManager.Text = ""
        End If
    End Sub
 
    Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnNext.Click
        If ValidateForm() = True Then
            SaveSetInfo()
        End If
        If Session("Saved") = "true" Then
            GoToNextTab()
        End If
    End Sub
    Private Function ValidateForm() As Boolean
        Dim msg As String = ""
 
 
        Page.Validate("SetInfo")
 
        If (Not Page.IsValid) Then
            ' Loop through all validation controls to see which
            ' generated the error(s).
            Dim oValidator As IValidator
            For Each oValidator In Page.Validators
                If oValidator.IsValid = False Then
                    If msg = "" Then
                        msg = oValidator.ErrorMessage
                    Else
                        msg = msg & "<br />" & oValidator.ErrorMessage
                    End If
                End If
            Next
            If ParentValidation() = False Then
                msg = msg & "<br />Duplicate parent values selected."
            End If
            lblErrors.Text = msg
            lblErrors.Visible = "true"
            Session("Saved") = "false"
            Return False
        ElseIf ParentValidation() = False Then
            msg = "Duplicate parent values selected."
            lblErrors.Text = msg
            lblErrors.Visible = "true"
            Session("Saved") = "false"
            Return False
        Else
            SaveSetInfo()
            Return True
        End If
 
    End Function
 
    Protected Sub SaveSetInfo()
        Dim strConn As String = ConfigurationManager.ConnectionStrings("STARConnectionString").ConnectionString
        Using connection As New SqlConnection(strConn)
            connection.Open()
            Using Command As New SqlCommand("USP_STAR_Update_SetInformationTEMP", connection)
                Try
                    Command.CommandType = Data.CommandType.StoredProcedure
                    Command.Parameters.AddWithValue("@SetNumber", lblSetNumber.Text)
                    Command.Parameters.AddWithValue("@FundID", cboFund.SelectedValue)
                    Command.Parameters.AddWithValue("@DateSubmitted", rdpDateSubmitted.DbSelectedDate)
                    Command.Parameters.AddWithValue("@SampleDescription", txtSampleDesc.Text)
                    Command.Parameters.AddWithValue("@HandlingConsiderations", txtHandling.Text)
                    Command.Parameters.AddWithValue("@SubmittedBy", IIf(cboSubmittedBy.SelectedValue = "", DBNull.Value, cboSubmittedBy.SelectedValue))
                    Command.Parameters.AddWithValue("@ConfidentialComments", txtConfidential.Text)
                    Command.Parameters.AddWithValue("@DisposeToID", IIf(cboDispose.SelectedValue = "", DBNull.Value, cboDispose.SelectedValue))
                    Command.Parameters.AddWithValue("@ParentOne", IIf(cboParentOne.SelectedValue = "", DBNull.Value, cboParentOne.SelectedValue))
                    Command.Parameters.AddWithValue("@ParentTwo", IIf(cboParentTwo.SelectedValue = "", DBNull.Value, cboParentTwo.SelectedValue))
                    Command.Parameters.AddWithValue("@ParentThree", IIf(cboParentThree.SelectedValue = "", DBNull.Value, cboParentThree.SelectedValue))
                    Command.ExecuteNonQuery()
                    Session("SetNumber") = lblSetNumber.Text
 
                    Session("Saved") = "true"
                    ' LoadMemberShipTo(ddlMembers.SelectedValue)
                Catch ex As Exception
 
                    If InStr(ex.Message, "Cannot insert duplicate key", CompareMethod.Text) > 0 Then
                        lblErrors.Visible = True
                        lblErrors.ForeColor = Drawing.Color.Red
                        lblErrors.Font.Size = 12
                        lblErrors.Text = ex.Message
                        Session("Saved") = "false"
                    Else
                        Session("Saved") = "false"
                        lblErrors.Visible = True
                        lblErrors.ForeColor = Drawing.Color.Red
                        lblErrors.Font.Size = 12
                        lblErrors.Text = ex.GetBaseException.Message.ToString
                    End If
 
                End Try
            End Using
        End Using
    End Sub
 
    Private Sub GoToNextTab()
        Session("SetNumber") = lblSetNumber.Text
        Dim tabStrip As RadTabStrip = NamingContainer.FindControl("rtsAddNewSet")
        Dim tabAttributes As RadTab = tabStrip.FindTabByText("Attributes")
        tabAttributes.Enabled = True
        tabAttributes.Selected = True
        GoToNextPageView()
    End Sub
    Private Sub GoToNextPageView()
        Dim multiPage As RadMultiPage = NamingContainer.FindControl("rmpAddNewSet")
        Dim pvAttributes As RadPageView = multiPage.FindPageViewByID("rpvAttributes")
        If pvAttributes Is Nothing Then
            pvAttributes = New RadPageView()
            pvAttributes.ID = "pageAttributes"
            multiPage.PageViews.Add(pvAttributes)
        End If
        pvAttributes.Selected = True
    End Sub
 
    Private Function ParentValidation() As Boolean
        Dim IsValid As Boolean = True
        If cboParentTwo.SelectedValue <> "" Then
            If cboParentOne.SelectedValue = cboParentTwo.SelectedValue Then
                IsValid = False
            End If
        End If
        If cboParentThree.SelectedValue <> "" Then
            If cboParentOne.SelectedValue = cboParentThree.SelectedValue Then
                IsValid = False
            End If
        End If
        If cboParentThree.SelectedValue <> "" Then
            If cboParentTwo.SelectedValue = cboParentThree.SelectedValue Then
                IsValid = False
            End If
        End If
        Return IsValid
 
 
    End Function
 
    Protected Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
        If ValidateForm() = True Then
            SaveSetInfo()
        End If
    End Sub
    Protected Sub rtsAddNewSet_TabClick(sender As Object, e As Telerik.Web.UI.RadTabStripEventArgs)
        If ValidateForm() = True Then
            SaveSetInfo()
        End If
    End Sub
 
 
End Class


Any input is greatly appreciated. I was looking through the Demo's online but didn't find anything very thorough with Multipage and user controls.

Thanks again,

AP




3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 11 Jul 2013, 02:47 PM
Hello Austin,

I am not quite sure, that I had understood the issue you are facing. If the RequiredFieldValidatiors does not validate the page (e.g. there are more fields to fill), the page will not postback, when a Tab is clicked. If the Page is valid, you could use the OnTabClick, in order to save the current data. Would you elaborate a bit more on the faced issue?

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
ADT
Top achievements
Rank 1
answered on 11 Jul 2013, 07:11 PM
I can get the page to postback and go to whatever tab the user selects, my issue was where do I force the save?

As displayed in my code below, I have a btnSave event that occurs, when the user clicks another one of the tabs I want the save to occur. But where do I catch that TabClick event? In the User control or on the main .aspx page that hosts the RadTabStrip/RadMultiPage? And if I have to do it on the main .aspx page, how do I fire off the code in a user control?

I'm new to TabStrips/Multi-page with user controls. I've done work on other pages before where all the code for the TabStrip/Multipage was all on 1 .aspx page, but that is not the most effective way as all the code is all in one page and become a jumbled mess.

That clear it up a bit?

Thanks,

Austin
0
Nencho
Telerik team
answered on 16 Jul 2013, 01:38 PM
Hello Austin,

You should handle the OnClick event in the main Page and access the controls in the UserControl, in order to extract the filled values. I would suggest you to refer to our online Wizard demo, demonstrating a similar functionality. Instead of a Save button, in the demo is used a Next button and the data from the UserControls is extracted and saved in the Preview user control. The button is located in the user controls, but you could use the approach, in order to access the controls in the UserControls.

Regards,
Nencho
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
TabStrip
Asked by
ADT
Top achievements
Rank 1
Answers by
Nencho
Telerik team
ADT
Top achievements
Rank 1
Share this question
or