Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to hide show the div on usercontrol using javascript
    primarykey
    data
    text
    <p>I have to develop the functionality for the que and rply for that i have create the user contol as per my requirment as fallow and i have add the div with the text box for rely and submit button on user control and keep the div disply style to none and i call the javascript on reply link which shows the that div.</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SuppReview.ascx.cs" Inherits="LaaFoodWebApp.SuppReview" %&gt; &lt;div&gt; &lt;table style="width:100%;"&gt; &lt;tr&gt; &lt;td rowspan="2" style="width: 15%; vertical-align: top;"&gt; &lt;asp:Label ID="lblMsgType" runat="server"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:Label ID="lblMsgId" runat="server"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td style="width: 70%; vertical-align: top;"&gt; &lt;asp:Label ID="lblMsgtBody" runat="server"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td style="width: 15%"&gt; &lt;asp:Label ID="lblVDate" runat="server"&gt;&lt;/asp:Label&gt; &lt;br /&gt; By &lt;asp:Label ID="lblname" runat="server"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;a id="toggleReply" style="color: #15ADFF" href="#"&gt;Reply&lt;/a&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:Label ID="lblEmail" runat="server"&gt;&lt;/asp:Label&gt; &lt;br /&gt; &lt;asp:Label ID="lblPhone" runat="server"&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;panel id="pnlreply" &gt; &lt;div id="DivReply" style="display:none"&gt; &lt;table style="width:100%;"&gt; &lt;tr&gt; &lt;td style="width: 15%"&gt; Replys&lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID="TextBox1" runat="server" Height="50px" TextMode="MultiLine" Width="100%"&gt;&lt;/asp:TextBox&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;td style="text-align: right"&gt; &lt;asp:Button ID="btnSubmit" runat="server" Text="Submit" onclick="btnSubmit_Click" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;&lt;/div&gt;&lt;/panel&gt; &lt;/td&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>But when i add those user control multiple time as per the count of replyes.</p> <pre><code>for (int i = 0; i&lt; dt.Rows.Count; i++) { SuppReview SR = (SuppReview)Page.LoadControl("SuppReview.ascx"); SR.settxt(dt.Rows[i]); reviews.Controls.Add(SR); } </code></pre> <p>on the page </p> <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/SupplierMasterNew.Master" AutoEventWireup="true" CodeBehind="Supp_Views.aspx.cs" Inherits="LaaFoodWebApp.Supp_Views" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"&gt; &lt;script type="text/javascript"&gt; $(function () { $('#toggleReply').click(function () { $('#DivReply').toggle('slow'); return false; }); }); &lt;/script&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="CPHcontent" runat="server"&gt; &lt;div style="width: 100%; height: 24px; background-color: #D2EEF2; padding-top: 10px; font-size: large; color: #000000; text-align: left;"&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; View&lt;/div&gt; &lt;asp:Panel ID="reviews" runat="server"&gt; &lt;/asp:Panel&gt; &lt;/asp:Content&gt; </code></pre> <p>On clicking on reply link int hide show the div (Contain text box for rely and submit button) multiple time and it not work for the other entry</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload