我在 TabContainer 中使用了3个 TabPanel 首先使用名称Insert 第2名,名字视图 第三是更新
现在我想点击插入按钮,光标会自动切换到在视图选项卡中输入的新记录 在视图选项卡中单击编辑它会自动切换到更新面板
请帮我编码
这是我的代码
在MasterPage上有TabContainer
<td>
<asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1">
<asp:TabPanel runat="server" ID="InsertTabPanel" HeaderText="Insert Data">
<ContentTemplate>
<p>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</p>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="ViewTabPanel" HeaderText="View Data">
<ContentTemplate>
<ul>
<a>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</a>
</ul>
</ContentTemplate>
</asp:TabPanel>
<asp:TabPanel runat="server" ID="UpdateTabPanel" HeaderText="Update Data">
<ContentTemplate>
<p>
<asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server">
</asp:ContentPlaceHolder>
</p>
</ContentTemplate>
</asp:TabPanel>
</asp:TabContainer>
</td>
然后在ContentPlaceholder中的主数据的各种子页面上像这样
<asp:Content ID="Content2" runat="server" contentplaceholderid="ContentPlaceHolder1">
<table style="width:100%;">
<tr>
<td>
<asp:Image ID="Image1" runat="server" Height="123px" ImageUrl="~/admin/images/insert.jpg" Width="158px" />
</td>
<td class="auto-style5">
<asp:Label ID="lblinsertion" runat="server" BackColor="#FFFF66" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="Insert Register User Information"></asp:Label>
</td>
<td class="auto-style9"> </td>
</tr>
<tr>
<td>
<asp:Label ID="lblusername" runat="server" Text="UserName" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style5">
<asp:TextBox ID="txtusername" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style9">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtusername" ErrorMessage="Please Enter UserName" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblpassword" runat="server" Text="Password" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style5">
<asp:TextBox ID="txtpassword" runat="server" ValidationGroup="vg1" TextMode="Password"></asp:TextBox>
</td>
<td class="auto-style9">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtpassword" ErrorMessage="please Enter Password" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblrolename" runat="server" Text="RoleName" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style5">
<asp:TextBox ID="txtrolename" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style9">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtrolename" ErrorMessage="Plese Enter Role Name" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lblemailid" runat="server" Text="Email Id" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="txtemailid" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style10">
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtemailid" ErrorMessage="please Enter Email ID" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style1">
<asp:Label ID="lblsecurityques" runat="server" Text="Security Question" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style7">
<asp:DropDownList ID="dropsecques" runat="server" Height="26px" Width="160px" ValidationGroup="vg1" AutoPostBack="True">
</asp:DropDownList>
</td>
<td class="auto-style11">
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="dropsecques" ErrorMessage="Please Enter SecurityQuestion" ValidationGroup="vg1" InitialValue="Select Security Question"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblsecurityans" runat="server" Text="Security Answer" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style5">
<asp:TextBox ID="txtsecans" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style9">
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ControlToValidate="txtsecans" ErrorMessage="Please Enter Security Answer" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style3"></td>
<td class="auto-style8">
<asp:Button ID="Login" runat="server" OnClick="Login_Click" Text="Login" Width="125px" ValidationGroup="vg1" />
</td>
<td class="auto-style12"></td>
</tr>
<tr>
<td colspan="3">
<asp:Label ID="lblerrormesglogin" runat="server" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
</tr>
</table>
</asp:Content>
<asp:Content ID="Content3" runat="server" contentplaceholderid="ContentPlaceHolder2">
<asp:Panel ID="ViewPanel" runat="server">
<table style="width:100%;">
<tr>
<td class="auto-style4">
<asp:Image ID="Image2" runat="server" Height="100px" ImageUrl="~/admin/images/view.jpg" Width="133px" />
</td>
<td>
<asp:Label ID="Label1" runat="server" BackColor="Yellow" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="View All Information"></asp:Label>
</td>
<td> </td>
</tr>
</table>
<asp:GridView ID="gridview" AutoGenerateColumns="False" runat="server" style="margin-left: 0px" AllowPaging="True" AllowSorting="True" CellPadding="3" Height="238px" OnRowCommand="gvLoginInfo_RowCommand" BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="Solid" BorderWidth="1px" CellSpacing="2">
<Columns>
<asp:BoundField HeaderText="UserName" DataField="UserName" />
<asp:BoundField HeaderText="Password" DataField="Password" />
<asp:BoundField HeaderText="Role Name" DataField="RoleName" />
<asp:BoundField HeaderText="Email Id" DataField="EmailID" />
<asp:BoundField HeaderText="Security Question" DataField="SecurityQuestion" />
<asp:BoundField HeaderText="Security Answer" DataField="SecurityAnswer" />
<asp:BoundField HeaderText="LastLogin" DataField="LastLogin" />
<asp:TemplateField HeaderText="Delete Record">
<ItemTemplate>
<asp:Button ID="delete" OnClientClick="return confirm('Are You Sure To Delete The Record?')" Text="Delete This Record" CommandName="del" CommandArgument='<%# Eval("UserName") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit Record">
<ItemTemplate>
<asp:Button ID="update" CommandName="upd" Text="Edit this Record" CommandArgument='<%# Eval("UserName") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#FFF1D4" />
<SortedAscendingHeaderStyle BackColor="#B95C30" />
<SortedDescendingCellStyle BackColor="#F1E5CE" />
<SortedDescendingHeaderStyle BackColor="#93451F" />
</asp:GridView>
<asp:Label ID="lblMessage" runat="server" Text=""></asp:Label>
<br />
</asp:Panel>
</asp:Content>
<asp:Content ID="Content4" runat="server" contentplaceholderid="ContentPlaceHolder3">
<asp:Panel ID="UpdatePanel" runat="server">
<table style="width:100%;">
<tr>
<td>
<asp:Image ID="Image3" runat="server" Height="106px" ImageUrl="~/admin/images/update.jpg" Width="133px" />
</td>
<td>
<asp:Label ID="Label2" runat="server" BackColor="Yellow" Font-Bold="True" Font-Italic="True" Font-Names="Euphemia" Font-Size="XX-Large" Font-Underline="True" ForeColor="#009900" Text="Update Your Information"></asp:Label>
</td>
<td> </td>
</tr>
<tr>
<td>
<asp:Label ID="lblupdusername" runat="server" Text="UserName" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtupdusername" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ControlToValidate="txtupdusername" ErrorMessage="Please Enter UserName" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style15">
<asp:Label ID="lblupdpassword" runat="server" Text="Password" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style15">
<asp:TextBox ID="txtupdpassword" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style15">
<asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" ControlToValidate="txtupdpassword" ErrorMessage="please Enter Password" ValidationGroup="vg1"></asp:RequiredFieldValidator>
<br />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtupdpassword" ErrorMessage="Password should contain atleast 8 alphanumeri digits" ValidationExpression="^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=]).*$"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblupdrolename" runat="server" Text="RoleName" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtupdrolename" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ControlToValidate="txtupdrolename" ErrorMessage="Plese Enter Role Name" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lblupdemailid" runat="server" Text="Email Id" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style2">
<asp:TextBox ID="txtupdemailid" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style2">
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ControlToValidate="txtupdemailid" ErrorMessage="please Enter Email ID" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style13">
<asp:Label ID="lblupdsecurityques" runat="server" Text="Security Question" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style13">
<asp:DropDownList ID="dropupdsecques" runat="server" Height="19px" Width="134px" ValidationGroup="vg1">
</asp:DropDownList>
</td>
<td class="auto-style13">
<asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="dropupdsecques" ErrorMessage="Please Enter SecurityQuestion" ValidationGroup="vg1" InitialValue="Select Security Question"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style14">
<asp:Label ID="lblupdsecurityans" runat="server" Text="Security Answer" Font-Bold="True" Font-Italic="True" Font-Size="Medium"></asp:Label>
</td>
<td class="auto-style14">
<asp:TextBox ID="txtupdsecans" runat="server" ValidationGroup="vg1"></asp:TextBox>
</td>
<td class="auto-style14">
<asp:RequiredFieldValidator ID="RequiredFieldValidator12" runat="server" ControlToValidate="txtupdsecans" ErrorMessage="Please Enter Security Answer" ValidationGroup="vg1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td> </td>
<td>
<asp:Button ID="btnUpdateLogin" runat="server" Text="Update" Width="125px" ValidationGroup="vg1" OnClick="btnUpdateLogin_Click" />
<asp:Button ID="btncancel" runat="server" Text="Cancel" OnClick="btncancel_Click" />
</td>
<td> </td>
</tr>
</table>
</asp:Panel>
</asp:Content>