Solved

My Controls Don't Show

Posted on 2011-03-22
2
640 Views
Last Modified: 2013-11-27
I am trying to use the ajax tabcontainer control in a project that creates a module for dotnetnuke. For the most part, in the first tab, everything works as it should, but on the second tab none of the controls show up on the vb code behind page so that I can set the events I can see and modify properties on the ascx page, but can't access any events on that page when I double click the linkbutton for example. On the vb page the error says that they are not declared and may be inaccessible. I think I can use 'Ctype(TabControl.FindControl("ControlName"), ControlType) to find the controls, but I don't know how to raise events like the 'Click' event or the 'Selected index changed' for the code behind along with them.
I need some help please.
Thanks in advance.
ASCX CONTROL--------------

<asp:TabContainer ID="SiteManagementTabContainer" runat="server" 
    ActiveTabIndex="1" Width="720px" BorderStyle="None" BorderWidth="0px" 
    Height="600px">
        <asp:TabPanel runat="server" HeaderText="Site Names" ID="SiteNamesTabPanel" BorderStyle="None" BorderWidth="0">
        <ContentTemplate>
            <div id="SiteInfo" class="SiteInfoContainer">
                <div id="SiteNameHead" class="SiteNameHeader">
                <h3>Select a Site Name to view details. You can edit the selected site or add a new one.</h3>
                </div>
                <div id="SiteNameNav" class="SiteNameNavButtons">
                <asp:LinkButton ID="AddSitesLinkButton" runat="server">Add A Site</asp:LinkButton>&nbsp;&nbsp;&nbsp; 
                <asp:LinkButton ID="DoneAddingEditingSitesLinkButton" runat="server" Visible="False" CausesValidation="False">Done Adding / Editing Sites</asp:LinkButton>
                </div>
                
                    <div id="SiteName" class="SiteNames">
                       <asp:GridView ID="SitesGridView" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" CellPadding="2" CellSpacing="4" 
                DataKeyNames="SiteID" DataSourceID="SitesSqlDataSource" 
                EnableModelValidation="True"><Columns><asp:CommandField ShowSelectButton="True" /><asp:BoundField DataField="SiteID" HeaderText="SiteID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="SiteID" Visible="False" /><asp:BoundField DataField="SiteName" HeaderText="SiteName" 
                        SortExpression="SiteName" /></Columns><RowStyle Font-Bold="True" ForeColor="#000066" /></asp:GridView>
                        
                        <asp:SqlDataSource ID="SitesSqlDataSource" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                        SelectCommand="SELECT [SiteID], [SiteName] FROM [sj_Sites]">
                        </asp:SqlDataSource>
                </div>

                        <div id="SiteDetails" class="SiteNameDetails">
                        <asp:DetailsView ID="AddEditSitesDetailsView" runat="server" 
                        AutoGenerateRows="False" CellPadding="2" CellSpacing="4" DataKeyNames="SiteID" 
                        DataSourceID="AddEditSitesSqlDataSource" EnableModelValidation="True" 
                        Width="300px">
                        <Fields><asp:BoundField DataField="SiteID" HeaderText="SiteID" InsertVisible="False" ReadOnly="True" SortExpression="SiteID" Visible="False" />
                                <asp:TemplateField HeaderText="Site Name" SortExpression="SiteName">
                                <EditItemTemplate><asp:TextBox ID="EditSiteNameTextBox" runat="server" Text='<%# Bind("SiteName") %>'></asp:TextBox><br />
                                <asp:RequiredFieldValidator ID="EditSiteNameRequiredFieldValidator" runat="server" ControlToValidate="EditSiteNameTextBox" 
                                        ErrorMessage="Enter a Site Name"></asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                        <asp:TextBox ID="SiteNameTextBox" runat="server" Text='<%# Bind("SiteName") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator runat="server" ID="SiteNameRequiredFieldValidator" ControlToValidate="SiteNameTextBox" ErrorMessage="Enter a Site Name"></asp:RequiredFieldValidator>
                                
                                        <asp:ValidatorCalloutExtender ID="SiteNameValidatorCalloutExtender" runat="server" targetcontrolid="SiteNameRequiredFieldValidator" >
                                        </asp:ValidatorCalloutExtender>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                <asp:Label ID="Label2" runat="server" Text='<%# Bind("SiteName") %>'></asp:Label>
                                </ItemTemplate><HeaderStyle Font-Bold="True" Font-Size="Larger" ForeColor="#000066" /></asp:TemplateField>
                                <asp:TemplateField HeaderText="Site Type" SortExpression="Type"><EditItemTemplate><asp:DropDownList ID="EditSiteTypeDropDownList" runat="server" 
                                        SelectedValue='<%# Bind("Type") %>'>
                                        <asp:ListItem>Select Site Type</asp:ListItem><asp:ListItem>School</asp:ListItem>
                                        <asp:ListItem>Club</asp:ListItem><asp:ListItem>Parks &amp; Rec</asp:ListItem>
                                        </asp:DropDownList><br />
                                        <asp:RequiredFieldValidator ID="EditSiteTypeRequiredFieldValidator" runat="server" ControlToValidate="EditSiteTypeDropDownList" ErrorMessage="Select a Site Type" InitialValue="Select a Site Type"></asp:RequiredFieldValidator></EditItemTemplate><InsertItemTemplate><asp:DropDownList ID="SiteTypeDropDownList" runat="server" 
                                        SelectedValue='<%# Bind("Type") %>'>
                                        <asp:ListItem>Select Site Type</asp:ListItem>
                                        <asp:ListItem>School</asp:ListItem>
                                        <asp:ListItem>Club</asp:ListItem>
                                        <asp:ListItem>Parks &amp; Rec</asp:ListItem>
                                        </asp:DropDownList><br />
                                        <asp:RequiredFieldValidator ID="SiteTypeRequiredFieldValidator" runat="server" ControlToValidate="SiteTypeDropDownList" ErrorMessage="Select a Site Type" 
                                        InitialValue="Select Site Type"></asp:RequiredFieldValidator>
                                
                                            <asp:ValidatorCalloutExtender ID="SiteTypeValidatorCalloutExtender" runat="server" TargetControlID="SiteTypeRequiredFieldValidator">
                                            </asp:ValidatorCalloutExtender>
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("Type") %>'></asp:Label>
                                        </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
                                        <asp:TemplateField HeaderText="Address" SortExpression="Address">
                                        <EditItemTemplate>
                                        <asp:TextBox ID="EditAddressTextBox" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="EditAddressRequiredFieldValidator" runat="server" ControlToValidate="EditAddressTextBox" 
                                        ErrorMessage="Enter an Address"></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <InsertItemTemplate>
                                        <asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="AddressRequiredFieldValidator" runat="server" ControlToValidate="AddressTextBox" ErrorMessage="Enter an Address"></asp:RequiredFieldValidator>
                                        <asp:ValidatorCalloutExtender ID="AddressValidatorCalloutExtender" runat="server" TargetControlID="AddressRequiredFieldValidator"></asp:ValidatorCalloutExtender>
                                        </InsertItemTemplate>
                                        <ItemTemplate>
                                        <asp:Label ID="Label4" runat="server" Text='<%# Bind("Address") %>'>
                                        </asp:Label>
                                        </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="City" SortExpression="City">
                                        <EditItemTemplate>
                                        <asp:TextBox ID="EditCityTextBox" runat="server" Text='<%# Bind("City") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="EditCityRequiredFieldValidator" runat="server" ControlToValidate="EditCityTextBox" ErrorMessage="Enter a City"></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <InsertItemTemplate>
                                        <asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="CityRequiredFieldValidator" runat="server" ControlToValidate="CityTextBox" ErrorMessage="Enter a City"></asp:RequiredFieldValidator>
                                        <asp:ValidatorCalloutExtender ID="CityValidatorCalloutExtender" runat="server" TargetControlID="CityRequiredFieldValidator">
                                        </asp:ValidatorCalloutExtender>
                                        </InsertItemTemplate>
                                        <ItemTemplate><asp:Label ID="Label5" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                                        </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" NullDisplayText="TX" />
                                        <asp:TemplateField HeaderText="Zip" SortExpression="Zip">
                                        <EditItemTemplate><asp:TextBox ID="EditZipTextBox" runat="server" Text='<%# Bind("Zip") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="EditZipRequiredFieldValidator" runat="server" ControlToValidate="EditZipTextBox" ErrorMessage=" Enter a Zip Code"></asp:RequiredFieldValidator>
                                        </EditItemTemplate>
                                        <InsertItemTemplate><asp:TextBox ID="ZipTextBox" runat="server" Text='<%# Bind("Zip") %>'></asp:TextBox><br />
                                        <asp:RequiredFieldValidator ID="ZipRequiredFieldValidator" runat="server" ControlToValidate="ZipTextBox" ErrorMessage=" Enter a Zip 
                                            Code"></asp:RequiredFieldValidator>
                                            </AJAXControls:ValidatorCalloutExtender>
                                            <asp:ValidatorCalloutExtender ID="ZipValidatorCalloutExtender" runat="server" TargetControlID="ZipRequiredFieldValidator"></asp:ValidatorCalloutExtender>
                                            </InsertItemTemplate>
                                            <ItemTemplate><asp:Label ID="Label6" runat="server" Text='<%# Bind("Zip") %>'></asp:Label></ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="NumberOfCourts" HeaderText="Number Of Available Courts" SortExpression="NumberOfCourts" />
                                            <asp:TemplateField HeaderText="Notes" SortExpression="Notes">
                                            <EditItemTemplate><asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
                                            </EditItemTemplate>
                                            <InsertItemTemplate><asp:TextBox ID="NotesTextBox" runat="server" Height="60px" Text='<%# Bind("Notes") %>' TextMode="MultiLine" Width="200px"></asp:TextBox>
                                            </InsertItemTemplate>
                                            <ItemTemplate><asp:Label ID="Label1" runat="server" Text='<%# Bind("Notes") %>'></asp:Label></ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:CommandField ShowEditButton="True" ShowInsertButton="True" />
                                            </Fields>
                                            </asp:DetailsView>

                        <asp:SqlDataSource ID="AddEditSitesSqlDataSource" runat="server" ConflictDetection="CompareAllValues" ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                                                                DeleteCommand="DELETE FROM [sj_Sites] WHERE [SiteID] = @original_SiteID AND [SiteName] = @original_SiteName 

                                        AND [Type] = @original_Type AND (([Phone] = @original_Phone) OR ([Phone] IS NULL AND @original_Phone IS NULL)) AND [Address] 

                                        = @original_Address AND [City] = @original_City AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS 

                                        NULL)) AND [Zip] = @original_Zip AND (([NumberOfCourts] = @original_NumberOfCourts) OR ([NumberOfCourts] IS NULL AND 

                                        @original_NumberOfCourts IS NULL)) AND (([Notes] = @original_Notes) OR ([Notes] IS NULL AND @original_Notes IS NULL))" 
                                                        InsertCommand="INSERT INTO [sj_Sites] ([SiteName], [Type], [Phone], [Address], [City], [State], [Zip], 

                                        [NumberOfCourts], [Notes]) VALUES (@SiteName, @Type, @Phone, @Address, @City, @State, @Zip, @NumberOfCourts, @Notes)" 
                                                        OldValuesParameterFormatString="original_{0}" 
                                                        SelectCommand="SELECT [SiteID], [SiteName], [Type], [Phone], [Address], [City], [State], [Zip], 

                                        [NumberOfCourts], [Notes] FROM [sj_Sites] WHERE ([SiteID] = @SiteID) ORDER BY [SiteName]" 
                                                        UpdateCommand="UPDATE [sj_Sites] SET [SiteName] = @SiteName, [Type] = @Type, [Phone] = @Phone, [Address] = 

                                        @Address, [City] = @City, [State] = @State, [Zip] = @Zip, [NumberOfCourts] = @NumberOfCourts, [Notes] = @Notes WHERE 

                                        [SiteID] = @original_SiteID AND [SiteName] = @original_SiteName AND [Type] = @original_Type AND (([Phone] = @original_Phone) 

                                        OR ([Phone] IS NULL AND @original_Phone IS NULL)) AND [Address] = @original_Address AND [City] = @original_City AND 

                                        (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL)) AND [Zip] = @original_Zip AND 

                                        (([NumberOfCourts] = @original_NumberOfCourts) OR ([NumberOfCourts] IS NULL AND @original_NumberOfCourts IS NULL)) AND 

                                        (([Notes] = @original_Notes) OR ([Notes] IS NULL AND @original_Notes IS NULL))">
                                        <DeleteParameters><asp:Parameter Name="original_SiteID" Type="Int32" />
                                        <asp:Parameter Name="original_SiteName" Type="String" />
                                        <asp:Parameter Name="original_Type" Type="String" />
                                        <asp:Parameter Name="original_Phone" Type="String" />
                                        <asp:Parameter Name="original_Address" Type="String" />
                                        <asp:Parameter Name="original_City" Type="String" />
                                        <asp:Parameter Name="original_State" Type="String" />
                                        <asp:Parameter Name="original_Zip" Type="String" />
                                        <asp:Parameter Name="original_NumberOfCourts" Type="Int32" />
                                        <asp:Parameter Name="original_Notes" Type="String" />
                                        </DeleteParameters><InsertParameters>
                                        <asp:Parameter Name="SiteName" Type="String" />
                                        <asp:Parameter Name="Type" Type="String" />
                                        <asp:Parameter Name="Phone" Type="String" />
                                        <asp:Parameter Name="Address" Type="String" />
                                        <asp:Parameter Name="City" Type="String" />
                                        <asp:Parameter Name="State" Type="String" />
                                        <asp:Parameter Name="Zip" Type="String" />
                                        <asp:Parameter Name="NumberOfCourts" Type="Int32" />
                                        <asp:Parameter Name="Notes" Type="String" />
                                        </InsertParameters><SelectParameters>
                                        <asp:ControlParameter ControlID="SitesGridView" Name="SiteID" PropertyName="SelectedValue" Type="Int32" />
                                        </SelectParameters>
                                        <UpdateParameters>
                                        <asp:Parameter Name="SiteName" Type="String" />
                                        <asp:Parameter Name="Type" Type="String" />
                                        <asp:Parameter Name="Phone" Type="String" />
                                        <asp:Parameter Name="Address" Type="String" />
                                        <asp:Parameter Name="City" Type="String" />
                                        <asp:Parameter Name="State" Type="String" />
                                        <asp:Parameter Name="Zip" Type="String" />
                                        <asp:Parameter Name="NumberOfCourts" Type="Int32" />
                                        <asp:Parameter Name="Notes" Type="String" />
                                        <asp:Parameter Name="original_SiteID" Type="Int32" />
                                        <asp:Parameter Name="original_SiteName" Type="String" />
                                        <asp:Parameter Name="original_Type" Type="String" />
                                        <asp:Parameter Name="original_Phone" Type="String" />
                                        <asp:Parameter Name="original_Address" Type="String" />
                                        <asp:Parameter Name="original_City" Type="String" />
                                        <asp:Parameter Name="original_State" Type="String" />
                                        <asp:Parameter Name="original_Zip" Type="String" />
                                        <asp:Parameter Name="original_NumberOfCourts" Type="Int32" />
                                        <asp:Parameter Name="original_Notes" Type="String" />
                                        </UpdateParameters></asp:SqlDataSource>
                  </div>
                </div>
         </ContentTemplate>
    </asp:TabPanel>

<asp:TabPanel ID="SiteDirectorsTabPanel" runat="server" HeaderText="Site Directors">
    <ContentTemplate>
        <div id="DirectorHead" class="DirectorHeader">
            <h3>Select a Site Director to view details. You can add a new Site Director.</h3>
        </div>
        <div id="DirectorNav" class="DirectorNavButtons">
            <asp:LinkButton ID="AddSiteDirectorLinkButton" runat="server">Add Site Director</asp:LinkButton> &nbsp; &nbsp; &nbsp; 
            <asp:LinkButton ID="DoneAddingSiteDirectorLinkButton" runat="server" CausesValidation="False" Visible="False">Done Adding Site Director</asp:LinkButton>

        </div>
        <div id="DirectorContainer" class="DirectorInfoContainer">
            <div id="Director" class="DirectorName">
            <asp:GridView ID="SiteDirectorGridView" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" DataSourceID="GetSiteDirectorSqlDataSource" 
                        EnableModelValidation="True" CellPadding="2" CellSpacing="4" Width="100%" 
                        DataKeyNames="SiteDirectorID">
                        <Columns>
                            <asp:CommandField ShowSelectButton="True" />
                            <asp:BoundField DataField="ProID" HeaderText="ProID" 
                                SortExpression="ProID" Visible="False" />
                            <asp:BoundField DataField="SiteDirectorID" HeaderText="SiteDirectorID" 
                                SortExpression="SiteDirectorID" InsertVisible="False" ReadOnly="True" 
                                Visible="False" />
                            <asp:BoundField DataField="Director" HeaderText="Director" ReadOnly="True" 
                                SortExpression="Director" />
                        </Columns>
                    </asp:GridView>
                   
                    <asp:SqlDataSource ID="GetSiteDirectorSqlDataSource" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>"                        
                        SelectCommand="SELECT sj_SiteDirectors.ProID, sj_SiteDirectors.SiteDirectorID, sj_ProInfo.FirstName + ' ' + sj_ProInfo.LastName AS Director FROM sj_SiteDirectors INNER JOIN sj_ProInfo ON sj_SiteDirectors.ProID = sj_ProInfo.ProID">
                    </asp:SqlDataSource>

            </div>
            <div id="DirectorInfo" class="DirectorDetails">
                <asp:DetailsView ID="AddSiteDirectorDetailsView" runat="server" Width="100%" 
                        AutoGenerateRows="False" CellPadding="2" CellSpacing="4" 
                        DataKeyNames="SiteDirectorID" DataSourceID="SiteDirectorDetailsSqlDataSource" 
                        EnableModelValidation="True">
                        <Fields>
                            <asp:BoundField DataField="SiteDirectorID" HeaderText="SiteDirectorID" 
                                InsertVisible="False" ReadOnly="True" SortExpression="SiteDirectorID" 
                                Visible="False" />
                            <asp:TemplateField HeaderText="Site Director ID" SortExpression="ProID">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="EditDirectorsDropDownList" runat="server" 
                                        DataSourceID="SiteDirectorDDLSqlDataSource" DataTextField="Approved Candidate" 
                                        DataValueField="ProID" SelectedValue='<%# Bind("ProID") %>' AppendDataBoundItems="True">
                                        <asp:ListItem Value="0">Select an Approved Candidate</asp:ListItem>
                                    </asp:DropDownList><br />
                                    <asp:RequiredFieldValidator ID="EditDirectorsRequiredFieldValidator" runat="server" ErrorMessage="Select an Approved Candidate" ControlToValidate="EditDirectorsDropDownList" InitialValue="0"></asp:RequiredFieldValidator>
                                    <asp:ValidatorCalloutExtender ID="EditDirectorsValidatorCalloutExtender" runat="server" TargetControlID="EditDirectorsRequiredFieldValidator">
                                    </asp:ValidatorCalloutExtender>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:DropDownList ID="DirectorsDropDownList" runat="server" 
                                        DataSourceID="SiteDirectorDDLSqlDataSource" DataTextField="Approved Candidate" 
                                        DataValueField="ProID" SelectedValue='<%# Bind("ProID") %>' AppendDataBoundItems="True">
                                        <asp:ListItem Value="0">Select an Approved Candidate</asp:ListItem>
                                    </asp:DropDownList><br />
                                    <asp:RequiredFieldValidator ID="DirectorsRequiredFieldValidator" runat="server" ErrorMessage="Select an Approved Candidate" ControlToValidate="DirectorsDropDownList" InitialValue="0"></asp:RequiredFieldValidator>
                                    <asp:ValidatorCalloutExtender ID="DirectorsValidatorCalloutExtender" runat="server" TargetControlID="DirectorsRequiredFieldValidator">
                                    </asp:ValidatorCalloutExtender>
                                    
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("ProID") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="InstructorLevel" 
                                SortExpression="InstructorLevel">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="EditInstructorLevelDropDownList" runat="server" 
                                        SelectedValue='<%# Bind("InstructorLevel") %>'>
                                        <asp:ListItem>Select Instructor Level</asp:ListItem>
                                        <asp:ListItem>Instructor</asp:ListItem>
                                        <asp:ListItem>Certified Instructor</asp:ListItem>
                                        <asp:ListItem>Pro</asp:ListItem>
                                        <asp:ListItem>Certified Pro</asp:ListItem>
                                    </asp:DropDownList>
                                    <asp:RequiredFieldValidator ID="EditInstructorLevelRequiredFieldValidator" runat="server" ErrorMessage="Select an Instructor Level" ControlToValidate="EditInstructorLevelDropDownList" InitialValue="Select Instructor Level"></asp:RequiredFieldValidator>
                                    <asp:ValidatorCalloutExtender ID="EditInstructorLevelValidatorCalloutExtender" TargetControlID="EditInstructorLevelRequiredFieldValidator" runat="server">
                                    </asp:ValidatorCalloutExtender>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:DropDownList ID="InstructorLevelDropDownList" runat="server" 
                                        SelectedValue='<%# Bind("InstructorLevel") %>'>
                                        <asp:ListItem>Select Instructor Level</asp:ListItem>
                                        <asp:ListItem>Instructor</asp:ListItem>
                                        <asp:ListItem>Certified Instructor</asp:ListItem>
                                        <asp:ListItem>Pro</asp:ListItem>
                                        <asp:ListItem>Certified Pro</asp:ListItem>
                                    </asp:DropDownList><br />
                                    <asp:RequiredFieldValidator ID="InstructorLevelRequiredFieldValidator" runat="server" ErrorMessage="Select an Instructor Level" ControlToValidate="InstructorLevelDropDownList" InitialValue="Select Instructor Level"></asp:RequiredFieldValidator>
                                        <asp:ValidatorCalloutExtender ID="InstructorLevelValidatorCalloutExtender" runat="server" TargetControlID="InstructorLevelRequiredFieldValidator">
                                        </asp:ValidatorCalloutExtender>
                                </InsertItemTemplate>
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("InstructorLevel") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:CommandField ShowInsertButton="True" ShowEditButton="True" />
                        </Fields>
                    </asp:DetailsView>
                    
                    <asp:SqlDataSource ID="SiteDirectorDetailsSqlDataSource" runat="server" 
                        ConflictDetection="CompareAllValues" 
                        ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                        DeleteCommand="DELETE FROM [sj_SiteDirectors] WHERE [SiteDirectorID] = @original_SiteDirectorID AND [ProID] = @original_ProID AND (([InstructorLevel] = @original_InstructorLevel) OR ([InstructorLevel] IS NULL AND @original_InstructorLevel IS NULL))" 
                        InsertCommand="INSERT INTO [sj_SiteDirectors] ([ProID], [InstructorLevel]) VALUES (@ProID, @InstructorLevel)" 
                        OldValuesParameterFormatString="original_{0}" 
                        SelectCommand="SELECT * FROM [sj_SiteDirectors] WHERE ([ProID] = @ProID)" 
                        UpdateCommand="UPDATE [sj_SiteDirectors] SET [ProID] = @ProID, [InstructorLevel] = @InstructorLevel WHERE [SiteDirectorID] = @original_SiteDirectorID AND [ProID] = @original_ProID AND (([InstructorLevel] = @original_InstructorLevel) OR ([InstructorLevel] IS NULL AND @original_InstructorLevel IS NULL))">
                        <DeleteParameters>
                            <asp:Parameter Name="original_SiteDirectorID" Type="Int32" />
                            <asp:Parameter Name="original_ProID" Type="Int32" />
                            <asp:Parameter Name="original_InstructorLevel" Type="String" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="ProID" Type="Int32" />
                            <asp:Parameter Name="InstructorLevel" Type="String" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:ControlParameter ControlID="SiteDirectorGridView" Name="ProID" 
                                PropertyName="SelectedValue" Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="ProID" Type="Int32" />
                            <asp:Parameter Name="InstructorLevel" Type="String" />
                            <asp:Parameter Name="original_SiteDirectorID" Type="Int32" />
                            <asp:Parameter Name="original_ProID" Type="Int32" />
                            <asp:Parameter Name="original_InstructorLevel" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:SqlDataSource ID="SiteDirectorDDLSqlDataSource" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:SiteSqlServer %>" 
                                        SelectCommand="SELECT ProID, FirstName + ' ' + LastName + ' ------ ' + TeachingLevel AS 'Approved Candidate' FROM sj_ProInfo">
                                    </asp:SqlDataSource>

            </div>
        
        </div>
            
    </ContentTemplate>
    </asp:TabPanel>
<asp:TabPanel ID="SiteRegistrationsTabPanel" runat="server" HeaderText="Site Registrations">
</asp:TabPanel>
</asp:TabContainer>


VB CODE--------

    Protected Sub DoneAddingEditingSitesLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DoneAddingEditingSitesLinkButton.Click

        AddEditSitesDetailsView.ChangeMode(DetailsViewMode.ReadOnly)
        AddEditSitesDetailsView.Visible = False
        DoneAddingEditingSitesLinkButton.Visible = False
        SitesGridView.Visible = True
        AddSitesLinkButton.Visible = True
    End Sub

    Protected Sub AddSitesLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AddSitesLinkButton.Click
        SitesGridView.Visible = False
        DoneAddingEditingSitesLinkButton.Visible = True
        AddEditSitesDetailsView.ChangeMode(DetailsViewMode.Insert)
        AddEditSitesDetailsView.Visible = True
        AddSitesLinkButton.Visible = False
    End Sub

    Private Sub AddEditSitesDetailsView_ItemInserted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewInsertedEventArgs) Handles AddEditSitesDetailsView.ItemInserted
        SitesGridView.DataBind()
    End Sub

    Private Sub SitesGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles SitesGridView.SelectedIndexChanged
        AddEditSitesDetailsView.DataBind()
        AddEditSitesDetailsView.Visible = True
        DoneAddingEditingSitesLinkButton.Visible = True
    End Sub

    Protected Sub AddSiteDirectorLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles AddSiteDirectorLinkButton.Click
        AddSiteDirectorDetailsView.ChangeMode(DetailsViewMode.Insert)
        AddSiteDirectorDetailsView.Visible = True
        DoneAddingSiteDirectorLinkButton.Visible = True
        AddSiteDirectorLinkButton.Visible = False
        SiteDirectorGridView.Visible = False
    End Sub

    Protected Sub DoneAddingSiteDirectorLinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles DoneAddingSiteDirectorLinkButton.Click
        AddSiteDirectorDetailsView.Visible = False
        DoneAddingSiteDirectorLinkButton.Visible = False
        AddSiteDirectorLinkButton.Visible = True
        SiteDirectorGridView.Visible = True
    End Sub

Open in new window

0
Comment
Question by:wdarnellg
2 Comments
 
LVL 18

Accepted Solution

by:
carlnorrbom earned 500 total points
ID: 35196792
Hi,

You can declare a generic handler and add event handlers to controls like this:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
    Dim btn1 As Button = CType(TabContainer.FindControl("Button1"), Button)
    Dim btn2 As Button = CType(TabContainer.FindControl("Button2"), Button)
    AddHandler btn1.Click, AddressOf HandleButtonClicks
    AddHandler btn2.Click, AddressOf HandleButtonClicks
End Sub

Private Sub HandleButtonClicks(ByVal sender As Object, ByVal e As EventArgs)
    Dim senderButton As Button = CType(sender, Button)
    If senderButton.ID.ToString() = "SomeID" Then
        'Logic goes here...
    End If
End Sub

Open in new window


/Carl.
0
 

Author Closing Comment

by:wdarnellg
ID: 35202283
Thank you Carl! This was a total answer to this question.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now