Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your javascript is throwing an error at src.endsWith("plus.png") because there is no built in endsWith function in js. replace that with src.substr(-8) == "plus.png" instead and it works:</p> <pre><code>&lt;script type="text/javascript"&gt; //master: id of div element that contains the information about master data //details: id of div element wrapping the details grid function showhide(master, detail) { //First child of master div is the image var src = $(master).children()[0].src; //Switch image from (+) to (-) or vice versa. if (src.substr(-8) == "plus.png") src = src.replace('plus.png', 'minus.png'); else src = src.replace('minus.png', 'plus.png'); //Set new image $(master).children()[0].src = src; //Toggle expand/collapse $(detail).slideToggle("normal"); } &lt;/script&gt; </code></pre> <p>EDIT - Working example:</p> <p><strong>MasterPage.master</strong></p> <pre><code>&lt;%@ Master Language="C#" AutoEventWireup="true" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; //master: id of div element that contains the information about master data //details: id of div element wrapping the details grid function showhide(master, detail) { //First child of master div is the image var src = $(master).children()[0].src; //Switch image from (+) to (-) or vice versa. if (src.substr(-8) == "plus.png") src = src.replace('plus.png', 'minus.png'); else src = src.replace('minus.png', 'plus.png'); //Set new image $(master).children()[0].src = src; //Toggle expand/collapse $(detail).slideToggle("normal"); } &lt;/script&gt; &lt;asp:ContentPlaceHolder id="head" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Default2.aspx</strong></p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" Title="Untitled Page" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"&gt; &lt;div class="searchgroup" id='master0' onclick='showhide("#master0","#detail0")'&gt; &lt;img id="ctl00_ContentPanel_gvMaster_ctl02_imgCollapsible" class="first" src="plus.png" style="border-width:0px;margin-right: 5px;" /&gt; &lt;span class="searchheader"&gt;ABC&lt;/span&gt; &lt;/div&gt; &lt;div id='detail0' class="searchdetail"&gt; &lt;div&gt; &lt;table class="searchgrid" id="ctl00_ContentPanel_gvMaster_ctl02_gvDtails"&gt; &lt;tr&gt; &lt;th&gt;Status&lt;/th&gt; &lt;/tr&gt; &lt;tr class="searchrow"&gt; &lt;td&gt;2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; &lt;/asp:Content&gt; </code></pre>
    singulars
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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