lundi 30 mars 2015

asp.net or input type checkbox

If I have an input checkbox:



<input id="Checkbox" type="checkbox" value='<%#Eval("MapID") %>' class="chk" runat="server"/>


and I want to convert it to an asp.net control



<asp:CheckBox runat="server" ID="Checkbox" class="chk"/>


what is equivalent to value in asp:checkBox?





set all check boxes inside page to false

I could have any number of checkboxes in my table.


<input type="checkbox" value='<%#Eval("MapID") %>' class="chk" runat="server"/>...


So how do I set all the checkboxes to false from code behind?



<asp:UpdatePanel runat="server" ID="AccesUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true">

<ContentTemplate>

<asp:ListView ID="lvCurrentMaps" runat="server" >
<LayoutTemplate>


<table cellpadding="0" cellspacing="0" border="0" class="display rndCorner2" id="example" width="100%">
<thead>
<tr id="Tr1" runat="server" class="itemTableHeader">
<td>
<asp:Label runat="server" ID="Label1" Text="Select" />
</td>
<td id="Td1" runat="server">
<asp:Label runat="server" ID="lblMapID" Text="Map ID" />
</td>
</tr>
</thead>
<tbody>
<tr id="itemPlaceholder" runat="server">
</tr>
</tbody>
</table>


</LayoutTemplate>
<ItemTemplate>
<tr id="Tr2" runat="server" class="itemTableData">
<td id="Td6" runat="server" class="chkbox">
<input type="checkbox" value='<%#Eval("MapID") %>' class="chk" runat="server"/>
</td>
<td id="Td1" runat="server" onclick='<%#"doPostBackForView("+Eval("MapID")+")" %>' style="cursor:pointer !important">
<asp:Label runat="server" ID="lblIDMapValue" Text= '<%#Eval("MapID") %>' />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr id="Tr2" runat="server" class="altItemTableData">
<td id="Td6" runat="server" class="chkbox">
<input id="Checkbox" type="checkbox" value='<%#Eval("MapID") %>' class="chk" runat="server"/>
</td>
<td id="Td1" runat="server" onclick='<%#"doPostBackForView("+Eval("MapID")+")" %>' style="cursor:pointer !important">
<asp:Label runat="server" ID="lblIDMapValue" Text= '<%#Eval("MapID") %>' />
</td>
<td id="Td8" runat="server" onclick='<%#"doPostBackForView("+Eval("MapID")+")" %>' style="cursor:pointer !important">
<asp:Label runat="server" ID="lblMapNameValue" Text= '<%#Eval("MapName") %>' />
</td>
<td id="Td9" runat="server" onclick='<%#"doPostBackForView("+Eval("MapID")+")" %>' style="cursor:pointer !important">
<asp:Label runat="server" ID="lblMapDescValue" Text= '<%#Eval("MapDesc") %>' />
</td>
</tr>
</AlternatingItemTemplate>

</asp:ListView>
</ContentTemplate>
</asp:UpdatePanel>


I was trying something like:



foreach(var li in lvCurrentMaps.Items)
{
li.DataItem = false;
}

AccesUpdatePanel.Update();


any ideas? possibly through a ScriptManager?





Generating checkboxes in Rails 4

I want to generate some checkboxes depending on select value. So i have select tag:





<%= f.collection_select :type, RequestType.order(:typeName), :id, :typeName,
{include_blank:true }, {:class => "types"} %>



When the value of select changes i want to generate some checkboxes, for that i have div:





<div id="sub_types"> </div>


where i want to generate my checkboxes



def show_sub_types
@rtype = params[:id];
@stypes = RequestSubType.where("request_type_id=?", @rtype).all
respond_to do |format|
format.js
format.html
end
end



My method grabs all subtypes and passes them to js file show_sub_types.js.erb



$("#sub_types").html("");
$("#sub_types").append("<%= j render 'show_sub_types', stypes: @stypes %>");



In my js file i render partial show_sub_types.html.erb in which i want to generate my checkboxes:



<% stypes.each do |type| %>
<%= check_box_tag "subtype", type.id %>
<%= type.subTypeName %>
<br>
<% end %>



In my partial i do something like this. This code generate me my checkboxes. They look like that:





<input type="checkbox" name="subtype" id="subtype" value="1">


But now i don't know how to submit these checkbox values with my form.I want to store multiple checkbox values in db as array.





Isotope filter checkbox and radio

Please Help me anyone know how to set isotop with radio button and checkboxes?


i have ex:


Gender = Male/Female (Radio button)


language = arabic, english, french (Checkboxes)


Country = UAE, USA, etc... (Checkboxes)


Thanks in advance, Rihan





dimanche 29 mars 2015

How to start inline editing on single click in checkbox column in free jqgrid

I'm looking for a way to start inline editing in jree jqgrid if clicked in checkbox column.


Currently I'm using ClickableCheckBoxFormatter


http://ift.tt/1IdBj7l


desribed in


http://ift.tt/1bIf2EP


and in


how to fix javascript exception if Oleg clickableCheckboxFormatter is used in jqGrid with single click editing


I tried free jqgrid checkbox formatter.


Issues:



  • If mouse cursor is placed over checkbox, mouse icon changes to disabled icon. This gives wrong hit to user like click does not work.

  • Actually double click starts inline editing


How to fix those so that checkbox behaves like ClickableCheckBoxFormatter:



  • Mouse cursor shape does not change

  • Single click in check box starts inline edit. First click should only start inline editing. Only click in inline editing mode should change checkbox state.





jQuery .prop('checked', true) don't work

I have a set of simple checkboxes, that can check multiple option, but I wish it to behave like a radio button where there will always be one option that is checked.


as you can see in my code, the checkbox will checked, and than uncheck. please let me know what I did wrong. Thanks





$('input[type=checkbox]').on('click', function(event) {
event.preventDefault();
if($('input[type=checkbox]:checked').length === 1 && $(this).is(':checked')) {
return false;
// there is only one checked AND the checked one is $this and we want to prevent it from uncheck
} else {
$(this).prop('checked', true);
alert($(this).prop('checked')); // this return true
}

});



<script src="http://ift.tt/1g1yFpr"></script>
<input type="checkbox" checked="checked"/>
<input type="checkbox"/>
<input type="checkbox"/>






check all checkboxes javascript

I'm trying to have all checkboxes checked (true) when the user clicks on "All" button. I tried this, firstly just to see if "Anglais" could be checked clicking on "All" :



<input type="checkbox" name="anglais" id="anglais" value="Anglais" /> Anglais
<input type="checkbox" name="allemand" id="allemand" value="Allemand" /> Allemand
<input type="checkbox" name="espagnol" id="espagnol" value="Espagnol" /> Espagnol
<input type="checkbox" name="francais" id="francais" value="Francais" /> Francais
<input type="checkbox" onclick="checkedAll()" name="all" id="all" value="Tous" /> Tous


My Javascript :



function checkedAll () {
var checked = false;
var all = document.getElementById('all');
if (checked == false) {
checked = true
}
else {
checked = false
}
var ang = document.getElementById('anglais').checked
if (ang == true) {
ang.checked = true;
}


But the button(s) are not checked when I click on All. I think I don't understand exactly how to use the .checked method..

Maybe, some of my code has not logic, because it was from this example : http://ift.tt/1CnsBCe