Note that there are some explanatory texts on larger screens.

plurals
  1. POToggle Button In Gridview not working?
    primarykey
    data
    text
    <p>I have created a toggle button which toggles on a single button through 4 states!</p> <p>The toggle button is in a GridView which in turn is nested within a FormView. The button works well in a HTML page and submits the value into a textbox as required when each one of the 4 images are selected. However it will not work when in the GridView! Can anybody assist or is there any known issues I should know about? </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $(".imageButton").ready(function() { $("img").click(function() { if ($(this).attr("src") == "../../../images/tick_50.png") { $(this).attr("src", '../../../images/excl_mark_50.png'); //orange image $(this).parent().siblings("input").attr("value", '2'); } else if ($(this).attr("src") == "../../../images/excl_mark_50.png") { $(this).attr("src", '../../../images/cross_50.png'); //red image $(this).parent().siblings("input").attr("value", '3'); } else if ($(this).attr("src") == "../../../images/cross_50.png") { $(this).attr("src", '../../../images/absent_50.png'); //blue image $(this).parent().siblings("input").attr("value", '4'); } else if ($(this).attr("src") == "../../../images/absent_50.png") { $(this).attr("src", '../../../images/tick_50.png'); //green image $(this).parent().siblings("input").attr("value", "1"); } }); }); }); &lt;/script&gt; &lt;asp:FormView ID="FormView1" runat="server" DataSourceId="SqlDataSource1" DataKeyNames="tt_id,s_id,n_id,o_id" AllowPaging="false"&gt; &lt;ItemTemplate&gt; &lt;br /&gt; &lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" CssClass="rounded-corner" DataKeyNames="tt_id,s_id,n_id,o_id" ShowFooter="True" &gt; &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Results" SortExpression="outcome" HeaderStyle-Font-Bold="true" &gt; &lt;EditItemTemplate &gt; &lt;div class="imageButton"&gt;&lt;a href="#"&gt; &lt;asp:Image ID="imgStatusEdit" runat="server" ImageURL='&lt;%# GetImage(CType(Eval("o_id"),Integer)) %&gt;' /&gt;&lt;/a&gt; &lt;asp:TextBox ID="txtOutcome" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;/div&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Image ID="imgStatus" runat="server" ImageURL='&lt;%# GetImage(CType(Eval("o_id"),Integer)) %&gt;' /&gt; &lt;%--&lt;asp:Label ID="Label2" runat="server" Text='&lt;%# Bind("o_id") %&gt;'&gt;&lt;/asp:Label&gt;--%&gt; &lt;/ItemTemplate&gt; &lt;HeaderStyle Font-Bold="True" /&gt; &lt;ItemStyle Width="67px" /&gt; &lt;/asp:TemplateField&gt; &lt;asp:TemplateField HeaderText="Notes" SortExpression="notes" ItemStyle-Width="" HeaderStyle-Font-Bold="true"&gt; &lt;EditItemTemplate&gt; &lt;asp:TextBox ID="txtNotes" runat="server" TextMode="MultiLine" Text='&lt;%#Eval("notes")%&gt;'&gt;&lt;/asp:TextBox&gt; &lt;/EditItemTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("notes")%&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;HeaderStyle Font-Bold="True" /&gt; &lt;/asp:TemplateField&gt; &lt;asp:CommandField ButtonType="Link" UpdateText="Update" CancelText="Cancel" EditText="Edit" ShowEditButton="True" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/ItemTemplate&gt; &lt;/asp:FormView&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    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