Show Hide controls in page on Button Click using C# and VB.Net in ASP.Net

Honeyjo
 
on Nov 10, 2021 09:58 PM
610 Views

Hello,

I'm converting a database to set of webforms.  Pages have a form where you can insert Person’s details such as First name, surname, DOB, referral reason, Descriptions etc. It also have two grids, an action grid and a sample grid. The data to these grids are from a set of buttons and text boxes in the same page. For example: When you put some details on Person A’s page, I can Press record action button and it will show me text boxes to record action details such as Action, Date and details and when I press submit it will show up in the grid on the same page.

Now each records have their own action and sample grids. How shall I do this bit?

PS:  The forms are connected to SQL server. I have attached the codes below.

           <td class="auto-style35" colspan="2">
                <asp:Label ID="Label7" runat="server" Font-Bold="True" Font-Underline="True" Text="Referral Details"></asp:Label>
            </td>
            <td class="auto-style35" colspan="4" aria-haspopup="False">
                <asp:Label ID="Label18" runat="server" Text="Actions" Font-Bold="True" Font-Underline="True"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="auto-style83">
                <asp:Label ID="lblhnout" runat="server" Text="Hosp No:"></asp:Label>
                &nbsp;<asp:TextBox ID="txthnout" runat="server"></asp:TextBox>
            </td>
            <td class="auto-style85">
                <asp:Label ID="lbldobout" runat="server" Text="DOB:"></asp:Label>
                <asp:TextBox ID="txtdobout" runat="server"></asp:TextBox>
            </td>
            <td class="auto-style35" aria-haspopup="False" colspan="4" rowspan="2">
                <br class="auto-style34" />
                <br />
                <br />
                <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataKeyNames="OutgoingActionTakenID" DataSourceID="Actions" Width="670px">
                    <Columns>
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                        <asp:BoundField DataField="OutgoingActionTakenID" HeaderText="ActionID" InsertVisible="False" ReadOnly="True" SortExpression="OutgoingActionTakenID" Visible="False" />
                        <asp:BoundField DataField="Actiontaken" HeaderText="Actiontaken" SortExpression="Actiontaken" />
                        <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                        <asp:BoundField DataField="Details" HeaderText="Details" SortExpression="Details" />
                    </Columns>
                </asp:GridView>
                <asp:SqlDataSource ID="Actionsout" runat="server"></asp:SqlDataSource>
                <asp:SqlDataSource ID="Actions" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Connection_Lookups %>" DeleteCommand="DELETE FROM [Action_Outgoing] WHERE [OutgoingActionTakenID] = @OutgoingActionTakenID" InsertCommand="INSERT INTO [Action_Outgoing] ([Actiontaken], [Date], [Details]) VALUES (@Actiontaken, @Date, @Details)" SelectCommand="SELECT [OutgoingActionTakenID], [Actiontaken], [Date], [Details] FROM [Action_Outgoing]" UpdateCommand="UPDATE [Action_Outgoing] SET [Actiontaken] = @Actiontaken, [Date] = @Date, [Details] = @Details WHERE [OutgoingActionTakenID] = @OutgoingActionTakenID">
                    <DeleteParameters>
                        <asp:Parameter Name="OutgoingActionTakenID" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Actiontaken" Type="String" />
                        <asp:Parameter DbType="Date" Name="Date" />
                        <asp:Parameter Name="Details" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Actiontaken" Type="String" />
                        <asp:Parameter DbType="Date" Name="Date" />
                        <asp:Parameter Name="Details" Type="String" />
                        <asp:Parameter Name="OutgoingActionTakenID" Type="Int32" />
                    </UpdateParameters>
                </asp:SqlDataSource>
            </td>
          
        <tr>
            <td class="auto-style83">
                <asp:Label ID="lblsurnameout" runat="server" Text="Surname:"></asp:Label>
                <asp:TextBox ID="txtsurnameout" runat="server"></asp:TextBox>
            </td>
            <td class="auto-style85">
                <asp:Label ID="Label5" runat="server" Text="Referred By: "></asp:Label>
                <asp:DropDownList ID="ddlrefbyout" runat="server" DataSourceID="refbyout" DataTextField="Referredby" DataValueField="ReferredbyID">
                </asp:DropDownList>
                <asp:SqlDataSource ID="refbyout" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Connection_Lookups %>" SelectCommand="SELECT [ReferredbyID], [Referredby] FROM [ref_referredby] ORDER BY [Referredby]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td class="auto-style83">
                <asp:Label ID="lblfirstnameout" runat="server" Text="Firstname:"></asp:Label>
                <asp:TextBox ID="txtfirstnameout" runat="server"></asp:TextBox>
            </td>
            <td class="auto-style85">
                <asp:Label ID="Label3" runat="server" Text="Research No:"></asp:Label>
                <asp:TextBox ID="txtrnumout" runat="server"></asp:TextBox>
            </td>
            <td aria-haspopup="False" class="auto-style35" colspan="4">
                <asp:Label ID="Label15" runat="server" Font-Bold="True" Font-Underline="True" Text="Samples"></asp:Label>
            </td>
        </tr>
            <tr>
                <td class="auto-style83">&nbsp;<asp:Label ID="Label1" runat="server" Text="Referral Reason:"></asp:Label>
                    <br class="auto-style34" />
                    <asp:DropDownList ID="ddlrefreasonout" runat="server" CssClass="auto-style22" DataSourceID="Refreasonout" DataTextField="Referralreason" DataValueField="ReferralreasonID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="Refreasonout" runat="server" ConnectionString="<%$ ConnectionStrings:SpecimenReferralsConnectionString %>" SelectCommand="SELECT [ReferralreasonID], [Referralreason] FROM [ref_referralreason] ORDER BY [Referralreason]"></asp:SqlDataSource>
                </td>
                <td class="auto-style85" rowspan="6">
                    <asp:Label ID="lblreftoout" runat="server" Text="Referred To:"></asp:Label>
                    <asp:DropDownList ID="ddlreftoout" runat="server" AutoPostBack="True" DataSourceID="refto" DataTextField="ExpertName" DataValueField="ReferralExpertID">
                    </asp:DropDownList>
                    <asp:SqlDataSource ID="refto" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Connection_Lookups %>" SelectCommand="SELECT [ReferralExpertID], [ExpertName], [ExpertInitial] FROM [ref_expert]"></asp:SqlDataSource>
                    &nbsp;<asp:Label ID="Label16" runat="server" AssociatedControlID="ddlreftoout" EnableViewState="False" Text="Label"></asp:Label>
                    <br />
                </td>
                <td aria-haspopup="False" class="auto-style35" colspan="4" rowspan="2">
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="OutgoingSamplesID" DataSourceID="Samples" Width="672px">
                        <Columns>
                            <asp:CommandField ShowEditButton="True" />
                            <asp:BoundField DataField="OutgoingSamplesID" HeaderText="SamplesID" InsertVisible="False" ReadOnly="True" SortExpression="OutgoingSamplesID" Visible="False" />
                            <asp:BoundField DataField="ReferenceNo" HeaderText="ReferenceNo" SortExpression="ReferenceNo" />
                            <asp:BoundField DataField="BlockNo" HeaderText="BlockNo" SortExpression="BlockNo" />
                            <asp:BoundField DataField="SlideNo" HeaderText="SlideNo" SortExpression="SlideNo" />
                            <asp:BoundField DataField="TissueNo" HeaderText="TissueNo" SortExpression="TissueNo" />
                            <asp:BoundField DataField="DateReturned" HeaderText="DateReturned" SortExpression="DateReturned" />
                        </Columns>
                    </asp:GridView>
                    <asp:SqlDataSource ID="Samples" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Connection_Lookups %>" DeleteCommand="DELETE FROM [Samples_Outgoing] WHERE [OutgoingSamplesID] = @OutgoingSamplesID" InsertCommand="INSERT INTO [Samples_Outgoing] ([ReferenceNo], [BlockNo], [SlideNo], [TissueNo], [DateReturned]) VALUES (@ReferenceNo, @BlockNo, @SlideNo, @TissueNo, @DateReturned)" SelectCommand="SELECT [OutgoingSamplesID], [ReferenceNo], [BlockNo], [SlideNo], [TissueNo], [DateReturned] FROM [Samples_Outgoing]" UpdateCommand="UPDATE [Samples_Outgoing] SET [ReferenceNo] = @ReferenceNo, [BlockNo] = @BlockNo, [SlideNo] = @SlideNo, [TissueNo] = @TissueNo, [DateReturned] = @DateReturned WHERE [OutgoingSamplesID] = @OutgoingSamplesID">
                        <DeleteParameters>
                            <asp:Parameter Name="OutgoingSamplesID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="ReferenceNo" Type="String" />
                            <asp:Parameter Name="BlockNo" Type="String" />
                            <asp:Parameter Name="SlideNo" Type="String" />
                            <asp:Parameter Name="TissueNo" Type="String" />
                            <asp:Parameter DbType="Date" Name="DateReturned" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="ReferenceNo" Type="String" />
                            <asp:Parameter Name="BlockNo" Type="String" />
                            <asp:Parameter Name="SlideNo" Type="String" />
                            <asp:Parameter Name="TissueNo" Type="String" />
                            <asp:Parameter DbType="Date" Name="DateReturned" />
                            <asp:Parameter Name="OutgoingSamplesID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </td>
            </tr>
            <tr>
                <td class="auto-style83" rowspan="3">
                    <asp:Label ID="Label2" runat="server" Text="Ethics No:"></asp:Label>
                    <asp:TextBox ID="txtenumout" runat="server"></asp:TextBox>
                    &nbsp;<br class="auto-style34" /> </td>
            </tr>
        <tr>
            <td class="auto-style35" colspan="2">
                <asp:HiddenField ID="HFID2" runat="server" />
                <asp:HiddenField ID="HFsavestatus2" runat="server" />
                <asp:HiddenField ID="HiddenField3" runat="server" />
                <br />
                <asp:Button ID="Btnrecordactionout" runat="server" Text="Record Action" />
                <br class="auto-style34" />
            </td>
            <td class="auto-style35" colspan="2">
                <asp:HiddenField ID="HFID1" runat="server" />
                <asp:HiddenField ID="HFsavestatus1" runat="server" />
                <asp:HiddenField ID="HiddenField2" runat="server" />
                <br />
                <asp:Button ID="Btnaddslidesout" runat="server" Text="Add Slides" />
            </td>
        </tr>
        <tr>
            <td class="auto-style86">
                <asp:Label ID="lblactionout" runat="server" Text="Action:" Visible="False"></asp:Label>
            </td>
            <td class="auto-style88">
                <asp:DropDownList ID="ddlactionout" runat="server" DataSourceID="Actiontaken" DataTextField="Actiontaken" DataValueField="ActiontakenID" Visible="False">
                </asp:DropDownList>
                <asp:SqlDataSource ID="Actiontaken" runat="server" ConnectionString="<%$ ConnectionStrings:Database_Connection_Lookups %>" SelectCommand="SELECT [ActiontakenID], [Actiontaken] FROM [ref_actiontaken] ORDER BY [Actiontaken]"></asp:SqlDataSource>
            </td>
            <td class="auto-style34">
                <asp:Label ID="lblrefnoslideout" runat="server" Text="Reference No:" Visible="False"></asp:Label>
            </td>
            <td class="auto-style34">
                <asp:TextBox ID="txtrefnoout" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="auto-style83" rowspan="2">
                &nbsp;<asp:Label ID="Label4" runat="server" Text="Date Sent:"></asp:Label>
                <asp:TextBox ID="txtdatesentout" runat="server" TextMode="Date"></asp:TextBox>
                <br class="auto-style34" />
            </td>
            <td class="auto-style86">
                <asp:Label ID="lblactiondateout" runat="server" Text="Date:" Visible="False"></asp:Label>
            </td>
            <td class="auto-style88">
                <asp:TextBox ID="txtactiondateout" runat="server" TextMode="Date" Visible="False"></asp:TextBox>
            </td>
            <td class="auto-style34">
                <asp:Label ID="lblblocknoslideout" runat="server" Text="Block No:" Visible="False"></asp:Label>
            </td>
            <td class="auto-style34">
                <asp:TextBox ID="txtblocknoout" runat="server" Visible="False"></asp:TextBox>
            </td>
        </tr>
            <tr>
                <td class="auto-style86" rowspan="3">
                    <asp:Label ID="lblactiondetailout" runat="server" Text="Detail:" Visible="False"></asp:Label>
                </td>
                <td class="auto-style88" rowspan="3">
                    <asp:TextBox ID="txtactdetailout" runat="server" Height="216px" TextMode="MultiLine" Visible="False" Width="211px"></asp:TextBox>
                </td>
                <td class="auto-style34">
                    <asp:Label ID="lblslidenoout" runat="server" Text="Slide No:" Visible="False"></asp:Label>
                </td>
                <td class="auto-style34">
                    <asp:TextBox ID="txtslidenoout" runat="server" Visible="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style68" colspan="2" rowspan="2">&nbsp;<br class="auto-style34" />
                    <asp:Label ID="Label6" runat="server" Text="Description:"></asp:Label>
                    &nbsp;<br class="auto-style34" /> &nbsp;<asp:TextBox ID="txtdescout" runat="server" Height="157px" TextMode="MultiLine" Width="564px"></asp:TextBox>
                </td>
                <td class="auto-style79">
                    <asp:Label ID="lbltissuenoout" runat="server" Text="Tissue No:" Visible="False"></asp:Label>
                </td>
                <td class="auto-style79">
                    <asp:TextBox ID="txttissuenoout" runat="server" Height="16px" Visible="False" Width="117px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style80">
                    <asp:Label ID="lbldateslideout" runat="server" Text="Date Returned:" Visible="False"></asp:Label>
                </td>
                <td class="auto-style80">
                    <asp:TextBox ID="txtdateretunout" runat="server" TextMode="Date" Visible="False"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style84">
                    <asp:Button ID="Btnsaveout" runat="server" Text="Save" Width="90px" />
                </td>
                <td class="auto-style82">
                    <asp:Button ID="Btncanout" runat="server" Text="Cancel" Width="90px" />
                </td>
                <td class="auto-style87">
                    <asp:Button ID="Btnactionoutsubmit" runat="server" Text="Submit" Visible="False" Width="90px" />
                </td>
                <td class="auto-style89">
                    <asp:Button ID="Btnactionclearout" runat="server" Text="Clear" Width="90px" />
                </td>
                <td class="auto-style81">
                    <asp:Button ID="Btnslideoutsubmit" runat="server" CssClass="auto-style72" Text="Submit" Visible="False" Width="90px" />
                </td>
                <td class="auto-style81">
                    <asp:Button ID="Btnclearslidesout" runat="server" Text="Clear" Width="90px" />
                </td>
            </tr>
    </table>
</asp:Panel>

Many Thanks

Honey JO

Download FREE API for Word, Excel and PDF in ASP.Net: Download
arjunv
 
on Nov 16, 2021 12:32 AM

Hi HoneyJo,

 Please refer below Sample And modify code for Visible true Or False as per your requirements.

HTML

<div class="pagewrap">
    <div class="w3-container">
        <div>
            <h1 style="background-color: #FFFFFF; width: 100%; border: 3px solid #4A3C8C; text-align: center;" class="auto-style2">Outgoing Referral</h1>
        </div>
        <asp:Panel ID="Pnldataentry" runat="server" Height="1500px">

            <asp:Panel ID="pnlformout" runat="server">
                <asp:HiddenField ID="HFID" runat="server" />
                <asp:HiddenField ID="HFsavestatus" runat="server" />
                <asp:HiddenField ID="HiddenField1" runat="server" />
                <br />
                <table class="auto-style16">
                    <tr>
                        <td class="auto-style35" colspan="2">
                            <asp:Label ID="Label7" runat="server" Font-Bold="True" Font-Underline="True" Text="Referral Details"></asp:Label>
                        </td>
                        <td class="auto-style35" colspan="2" aria-haspopup="False">
                            <asp:Label ID="Label18" runat="server" Text="Actions" Font-Bold="True" Font-Underline="True"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="auto-style99">
                            <asp:Label ID="lblhnout" runat="server" Text="Hosp No:"></asp:Label>
                            &nbsp;<asp:TextBox ID="txthnout" runat="server"></asp:TextBox>
                        </td>
                        <td class="auto-style100">
                            <asp:Label ID="lbldobout" runat="server" Text="DOB:"></asp:Label>
                            <asp:TextBox ID="txtdobout" runat="server"></asp:TextBox>
                        </td>
                        <td class="auto-style35" aria-haspopup="False" colspan="2" rowspan="2">
                            <br class="auto-style34" />
                            <br />
                            <br />
                            <asp:GridView ID="gvActionout" runat="server" AutoGenerateColumns="False" DataKeyNames="EmployeeId" Width="670px" Visible="false" AllowPaging="True" DataSourceID="Actionsout">
                                <Columns>
                                    <asp:CommandField ShowSelectButton="True" />
                                    <asp:BoundField DataField="EmployeeId" HeaderText="Employee Id" InsertVisible="False" ReadOnly="True" SortExpression="EmployeeId" Visible="False" />
                                    <asp:BoundField DataField="FirstName" HeaderText="First Name" SortExpression="FirstName" />
                                    <asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="Last Name" />
                                    <asp:BoundField DataField="BirthDate" HeaderText="Birth Date" SortExpression="BirthDate" />
                                </Columns>
                            </asp:GridView>
                            <asp:SqlDataSource ID="Actionsout" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT EmployeeId, FirstName, LastName, BirthDate From Employees"></asp:SqlDataSource>
                        </td>

                        <tr>
                            <td class="auto-style101">
                                <asp:Label ID="lblsurnameout" runat="server" Text="Surname:"></asp:Label>
                                <asp:TextBox ID="txtsurnameout" runat="server"></asp:TextBox>
                            </td>
                            <td class="auto-style102">
                                <asp:Label ID="Label5" runat="server" Text="Referred By: "></asp:Label>
                                <asp:DropDownList ID="ddlrefbyout" runat="server" DataSourceID="refbyout" DataTextField="EmployeeId" DataValueField="EmployeeId">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="refbyout" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT EmployeeId, FirstName, LastName, BirthDate From Employees"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style92">
                                <asp:Label ID="lblfirstnameout" runat="server" Text="Firstname:"></asp:Label>
                                <asp:TextBox ID="txtfirstnameout" runat="server"></asp:TextBox>
                            </td>
                            <td class="auto-style93">
                                <asp:Label ID="Label3" runat="server" Text="Research No:"></asp:Label>
                                <asp:TextBox ID="txtrnumout" runat="server"></asp:TextBox>
                            </td>
                            <td aria-haspopup="False" class="auto-style35" colspan="2">
                                <asp:Label ID="Label15" runat="server" Font-Bold="True" Font-Underline="True" Text="Samples"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style92">&nbsp;<asp:Label ID="Label1" runat="server" Text="Referral Reason:"></asp:Label>
                                <br class="auto-style34" />
                                <asp:DropDownList ID="ddlrefreasonout" runat="server" CssClass="auto-style22" DataSourceID="Refreasonout" DataTextField="EmployeeId" DataValueField="EmployeeId">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="Refreasonout" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT EmployeeId, FirstName, LastName FROM Employees"></asp:SqlDataSource>
                            </td>
                            <td class="auto-style93" rowspan="3">&nbsp;<br />
                                <asp:Label ID="Label6" runat="server" Text="Description:"></asp:Label>
                                <asp:TextBox ID="txtdescout" runat="server" Height="380px" TextMode="MultiLine" Width="290px" Visible="false"></asp:TextBox>
                            </td>
                            <td aria-haspopup="False" class="auto-style35" colspan="2" rowspan="2">
                                <asp:GridView ID="gvSlideout" runat="server" AutoGenerateColumns="False" DataKeyNames="CustomerId" Width="672px" AllowPaging="True" Visible="false" DataSourceID="Samples">
                                    <Columns>
                                        <asp:CommandField ShowSelectButton="True" />
                                        <asp:BoundField DataField="CustomerId" HeaderText="Customer Id" InsertVisible="False" ReadOnly="True" SortExpression="CustomerId" Visible="False" />
                                        <asp:BoundField DataField="CompanyName" HeaderText="Company Name" SortExpression="CompanyName" />
                                        <asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
                                        <asp:BoundField DataField="Country" HeaderText="Country" SortExpression="Country" />
                                        <asp:BoundField DataField="PostalCode" HeaderText="PostalCode" SortExpression="PostalCode" />
                                        <asp:BoundField DataField="Region" HeaderText="Region" SortExpression="Region" />
                                    </Columns>
                                </asp:GridView>
                                <asp:SqlDataSource ID="Samples" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT TOP 10 CustomerId, CompanyName, ContactName, City, Country, PostalCode, Region From Customers"></asp:SqlDataSource>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style92">
                                <asp:Label ID="Label2" runat="server" Text="Ethics No:"></asp:Label>
                                <asp:TextBox ID="txtenumout" runat="server"></asp:TextBox>
                                &nbsp;<br class="auto-style34" />
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style92">
                                <asp:Label ID="Label4" runat="server" Text="Date Sent:" Visible="false"></asp:Label>
                                <asp:TextBox ID="txtdatesentout" runat="server" TextMode="Date" Visible="false"></asp:TextBox>
                            </td>
                            <td class="auto-style90">
                                <asp:HiddenField ID="HFID2" runat="server" />
                                <asp:HiddenField ID="HFsavestatus2" runat="server" />
                                <asp:HiddenField ID="HiddenField3" runat="server" />
                                <br />
                                <asp:Button ID="Btnrecordactionout" runat="server" Text="Record Action" Visible="True" OnClick="OnAction" />
                                <br class="auto-style34" />
                            </td>
                            <td class="auto-style94">
                                <asp:HiddenField ID="HFID1" runat="server" />
                                <asp:HiddenField ID="HFsavestatus1" runat="server" />
                                <asp:HiddenField ID="HiddenField2" runat="server" />
                                <br />
                                <asp:Button ID="Btnaddslidesout" runat="server" Text="Add Slides" Visible="False" />
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style101">
                                <asp:Label ID="lblreftoout" runat="server" Text="Referred To:"></asp:Label>
                                <asp:DropDownList ID="ddlreftoout" runat="server" AutoPostBack="True" DataSourceID="refto" DataTextField="CompanyName" DataValueField="CompanyName">
                                </asp:DropDownList>
                                <asp:SqlDataSource ID="refto" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT CustomerId, CompanyName FROM Customers"></asp:SqlDataSource>
                                <asp:Label ID="Label16" runat="server" AssociatedControlID="ddlreftoout" EnableViewState="False" Text="Label"></asp:Label>
                            </td>
                            <td class="auto-style93" rowspan="2">&nbsp;</td>
                            <td class="auto-style97">
                                <asp:Panel ID="Pnlactionout" runat="server" Visible="False">
                                    <table class="auto-style2">
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblactionout" runat="server" Text="Action:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:DropDownList ID="ddlactionout" runat="server" DataSourceID="Actiontaken" DataTextField="Actiontaken" DataValueField="ActiontakenID">
                                                </asp:DropDownList>
                                                <asp:SqlDataSource ID="Actiontaken" runat="server" ConnectionString="<%$ ConnectionStrings:constr %>" SelectCommand="SELECT [CustomerId], [CompanyName] FROM [Customers] ORDER BY [CompanyName]"></asp:SqlDataSource>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblactiondateout" runat="server" Text="Date:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtactiondateout" runat="server" TextMode="Date"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblactiondetailout" runat="server" Text="Detail:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtactdetailout" runat="server" Height="88px" TextMode="MultiLine" Width="251px"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Button ID="Btnactionoutsubmit" runat="server" Text="Submit" Width="90px" />
                                            </td>
                                            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <asp:Button ID="Btnactionclearout" runat="server" Text="Clear" Width="90px" />
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                            <td class="auto-style98">
                                <asp:Panel ID="Pnlslidesout" runat="server" Visible="False">
                                    <table class="auto-style2">
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblrefnoslideout" runat="server" Text="Reference No:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtrefnoout" runat="server"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblblocknoslideout" runat="server" Text="Block No:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtblocknoout" runat="server"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lblslidenoout" runat="server" Text="Slide No:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtslidenoout" runat="server"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lbltissuenoout" runat="server" Text="Tissue No:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txttissuenoout" runat="server" Height="16px" Width="117px"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Label ID="lbldateslideout" runat="server" Text="Date Returned:"></asp:Label>
                                            </td>
                                            <td>
                                                <asp:TextBox ID="txtdateretunout" runat="server" TextMode="Date"></asp:TextBox>
                                                <br />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:Button ID="Btnslideoutsubmit" runat="server" CssClass="auto-style72" Text="Submit" Width="90px" />
                                            </td>
                                            <td>
                                                <asp:Button ID="Btnclearslidesout" runat="server" Text="Clear" Width="90px" />
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td class="auto-style97" rowspan="2">
                                <asp:Button ID="Btnsaveout" runat="server" Text="Save" Width="90px" OnClick="OnSave" />
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <asp:Button ID="Btncanout" runat="server" Text="Cancel" Width="90px" />
                            </td>
                            <td class="auto-style98" rowspan="2">&nbsp;</td>
                            <td class="auto-style92">&nbsp;<br class="auto-style34" />
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
                        </tr>
                        <tr>
                            <td class="auto-style84">&nbsp;</td>
                            <td class="auto-style82">&nbsp;</td>
                        </tr>
                </table>
            </asp:Panel>
            <br />
            <br />
        </asp:Panel>
    </div>
</div>

Code

C#

protected void OnAction(object sender, EventArgs e)
{
    gvActionout.Visible = true;
    txtdatesentout.Visible = true;
    txtdescout.Visible = true;        
}
    
protected void OnSave(object sender, EventArgs e)
{
    gvSlideout.Visible = true;
}

VB.Net

Protected Sub OnAction(ByVal sender As Object, ByVal e As EventArgs)
    gvActionout.Visible = True
    txtdatesentout.Visible = True
    txtdescout.Visible = True
End Sub
Protected Sub OnSave(ByVal sender As Object, ByVal e As EventArgs)
    gvSlideout.Visible = True
End Sub