2016-09-02 2 views
0

kollabierten div als offen zu halten, ist mein Javascript gridview Reihen in asp.netwie Below nach dem Postback

<script type="text/javascript"> 
    function divexpandcollapse(divname) { 
     var div = document.getElementById(divname); 
     var img = document.getElementById('img' + divname); 
     if (div.style.display == "none") { 
      div.style.display = "inline"; 
      img.src = "Img1/minus.gif"; 
     } else { 
      div.style.display = "none"; 
      img.src = "Img1/plus.gif"; 
     } 
    } 
</script> 

Und das ist mein Gridview Template

 <asp:TemplateField> 
      <ItemTemplate> 
       <a href="JavaScript:divexpandcollapse('div<%# Eval("ClaimMasterId") %>');"> 
        <img id='imgdiv<%# Eval("ClaimMasterId") %>' width="9px" border="0" src="Img1/plus.gif" alt="" title="Add Action Notes" /></a>       
      </ItemTemplate> 
      <ItemStyle Width="10px" VerticalAlign="Middle"></ItemStyle> 
     </asp:TemplateField> 


     <asp:TemplateField> 
      <ItemTemplate> 
       <tr> 
        <td colspan="100%" style="background:#F5F5F5"> 
         <div id='div<%# Eval("ClaimMasterId") %>' style="overflow:auto; display:none; position: relative; left: 15px; overflow: auto;"> 
          <div style="width:900px; -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175); box-shadow: 0 6px 12px rgba(0,0,0,.175); -moz-box-shadow: 0 6px 12px rgba(0,0,0,.175);"> 
         <table> 
          <tr> 
           <td style="vertical-align:top"> 
            <asp:RadioButtonList ID="MoveToRBL" runat="server" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="MoveToRBL_SelectedIndexChanged" > 
             <asp:ListItem Text="Review" Value="Review" Selected="True"></asp:ListItem> 
             <asp:ListItem Text="Call" Value="Call"></asp:ListItem> 
             <asp:ListItem Text="Re-Call" Value="ReCall"></asp:ListItem> 
             <asp:ListItem Text="Audit" Value="Audit"></asp:ListItem> 
            </asp:RadioButtonList>&nbsp;&nbsp; 
           </td> 
           <td style="vertical-align:top"> 
            <asp:ImageButton ID="SaveButton" runat="server" ImageUrl="~/Img1/save32.png" ToolTip="Save" OnClick="SaveButton_Click" /> 
           </td> 
          </tr> 
         </table> 
           </div> 
         </div>      
        </td> 
       </tr> 
      </ItemTemplate> 
      <ItemStyle Width="1px" ></ItemStyle> 
     </asp:TemplateField> 

Erweiterung & Einstürzen sind Aufklappen/Zuklappen funktioniert gut, aber immer wenn RadioButtonList "MoveToRBL" angeklickt wird, dann ist das erweiterte div kollabiert. Dann muss ich erneut auf das Plus-Symbol klicken, um es zu erweitern. Warum es passiert ist, wie man es stoppt. Alles, was ich in Javascript ändern muss, lass es mich wissen.

Antwort

0

Erreicht durch UpdatePanel mit Conditional-Modus wie folgt.

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" > 
<ContentTemplate> 
<asp:DropDownList ID="AllocateToDDL" runat="server" CssClass="dropdown" Visible="true" Width="135px" AppendDataBoundItems="True" DataSourceID="GetARmembers" DataTextField="EmpName" DataValueField="EmpName" > 
<asp:ListItem Text="Select the Caller" Value="NA" Selected="True"></asp:ListItem> 
</asp:DropDownList> 
</ContentTemplate> 
<Triggers> 
<asp:AsyncPostBackTrigger ControlID="MoveToRBL" EventName="SelectedIndexChanged" /> 
</Triggers> 
</asp:UpdatePanel> 
Verwandte Themen