在Repeater控制中编辑更新按钮

时间:2013-10-07 06:07:04

标签: asp.net vb.net webforms

我在div中有可折叠面板的转发器控件。(类标题和类详细信息)。当我单击细节部分内的编辑按钮时 - 取消和更新按钮显示但是当我单击编辑按钮时div正在折叠并且只有在再次单击该行后才能看到更新和取消按钮..

除了下面说明的一件事之外,每件事都很好。 每次点击编辑按钮时,分割都会折叠 在编辑/取消/更新之前,如何使课程细节稳定。

由于

 <style>
.header { font-size: larger; font-weight: bold; cursor: hand; cursor:pointer;
       background-color:#cccccc; font-family: Verdana; }
.details { display:none; visibility:hidden; 
         font-family: Verdana; }
</style>

&nbsp;<div style="overflow: scroll; overflow-x: hidden; overflow-y: auto;background-  color:gray;     height: 500px; width: 895px">

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">

      <ItemTemplate>


 <div id='h<%# DataBinder.Eval(Container, "ItemIndex") %>' class="header"
   onclick='ToggleDisplay(<%# DataBinder.Eval(Container, "ItemIndex") %>);' style="border-style: none;">
 <asp:Panel ID="Panel3" runat="server" Height="30px" BorderStyle="None" BackColor="#79FFFF">

<%# DataBinder.Eval(Container.DataItem, "License")%> 
<%# DataBinder.Eval(Container.DataItem, "Name")%>

<%# DataBinder.Eval(Container.DataItem," Date")%>

   

 <div id='d<%# DataBinder.Eval(Container, "ItemIndex") %>' class="details">

 <asp:Panel ID="Panel2" runat="server" Height="195px" BackColor="Gray" Font-Bold="False"   ForeColor="Maroon">
 <br />
    <asp:Label ID="Label1" runat="server" Text="LicenseID"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;

             <asp:TextBox ID="TextBox1" runat="server" Text='<%# DataBinder.Eval  (Container.DataItem,"LicenseID") %>' Enabled="False" BackColor="Gray"   BorderStyle="None"></asp:TextBox>
    <asp:Label ID="Label2" runat="server" Text="License  Name"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
             <asp:TextBox ID="TextBox2" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"LicenseName")%>' Enabled="false" BackColor="Gray" BorderStyle="None"></asp:TextBox>

         </asp:Panel>

 </div>

      </ItemTemplate>  

切换显示

        function ToggleDisplay(id) {
       var elem = document.getElementById('d' + id);
       if (elem) {
            if (elem.style.display != 'block') {
            elem.style.display = 'block';
            elem.style.visibility = 'visible';
        }
        else {
            elem.style.display = 'none';
            elem.style.visibility = 'hidden';
        }
    }
    }

0 个答案:

没有答案