Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isn't this script running from the masterpage?
    primarykey
    data
    text
    <p>I have a Page that is associated with a master page. In the master page, I put the css links in the head section and I put the jquery script tag and the script that contains the function to toggle the grid, but when it is not working. Looks like it is not even calling showhide when I click on an item.</p> <p>Here is a snippet of the master page:</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;link href="MainLayout.css" rel="stylesheet" type="text/css" /&gt; &lt;link href="ajaxtab.css" rel="stylesheet" type="text/css" /&gt; &lt;link href="dialog.css" rel="stylesheet" type="text/css" /&gt; &lt;link href="grid.css" rel="stylesheet" type="text/css" /&gt; &lt;link href="pager.css" rel="stylesheet" type="text/css" /&gt; &lt;link href="subgrid.css" rel="stylesheet" type="text/css" /&gt; &lt;script src="jquery-1.3.2.min.js" type="text/javascript"&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.endsWith("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; </code></pre> <p>Here is the div that contains the showhide function in the onclick event in the aspx page:</p> <pre><code>&lt;div class="searchgroup" id='&lt;%#String.Format("master{0}",Container.DataItemIndex)%&gt;' onclick='showhide(&lt;%#String.Format("\"#master{0}\"",Container.DataItemIndex)%&gt; , &lt;%#String.Format("\"#detail{0}\"",Container.DataItemIndex) %&gt;)'&gt; &lt;asp:Image ID="imgCollapsible" CssClass="first" ImageUrl="plus.png" Style="margin-right: 5px;" runat="server" /&gt; &lt;span class="searchheader"&gt;&lt;%#Eval("Business")%&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>Here is html it generates for the master and detail div:</p> <pre><code>//master div &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; //details div &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 class="searchrow"&gt; &lt;td&gt;2&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I could not get the JQuery working and I was running out of time, so for now I decided to use the collapsible panel externder from the ajax control toolkit. When I get time, I will investigate the JQuery Issue, Thanks for all your suggestions so far. If anyone has any more, please let me know.</p>
    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. 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