i am using an checkboslist binding to a datatable.
but here i need to make user select only one item selected from checkbox list
is there way we can aachive this
either JQuery, javascript, c#
thank you
If the user is only allowed to select one item from a list, you should use radio buttons instead of checkboxes.
UPDATE:
If you have to use checkboxes then you can use the following code:
$("#myform :checkbox").click(function(){
$("#myform input:checked").attr("checked","");
$(this).attr("checked","checked");
});
Related
I would like to know how to implement check all checkbox button and single checkbox work as well like i have four checkboxes and want to check them all on select all check box and when all checkboxes selected all checkbox have to be selected.
I have a grid with ASPxCheckBox in Data Item Template. How to get KeyFieldValue of all rows whose checkbox is checked. I am trying to do this using client-side code and do it for whole grid not on visible index. Is it possible?
Note: I cannot use simple row selection command column as I am using it for some other purpose.
if you dontuse client-side code, you should use detailrow in aspxgridview. And you must use beforeperformdataselect event. if you really need checkbox, you can add checkbox a new field in asapxgridview.
I have a dropdown list of 5 elements. My problem is that I want to make this dropdown list editable. Basically a user might want to delete one of these elements or might want to add more elements. Whats a good approach of doing that in asp.net ?
Use a ComboBox.
You have to put textbox for typing text and button for user to insert into the list and button for delete
Do you know the code to adding and deleting list in the dropdown list right ?
Use a ListBox - that way they can make a multi-selection of their choice:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.aspx
The DropDownList is not intended for multi-selection. Another option would be to use CheckBoxes.
If you use DataBase, u can make dropdownlist MORE editable with elements like "formView", "gridView" and so on..
I have a gridview that has a checkbox (inside TemplateField). I would like to grab all the selected rows and reassign them to a new gridview. Any ideas on how I can go about doing this?
Thanking you in advance.
If I understand your question, the easisest way to do it is to wrap the second grid in a separate grid. Assuming you have named the checkboxses the same id for your second grid, you can use jquery plugin to detect selection of the first grid's check boxes, loop through the results and set check boxes of your second grid inside that other div to "checked" since the names of the chck boxes match.
Something like that:
$(document).ready(function () {
$('#BaseDiv > input[name=checkboxlist]:checked').each(function() {
//TODO: Retrieve the checkboxes from the second div using the combination of second div id and search for it's children check boxes.
});
});
just fetch all the checked rows from the first gridview and add them into a datatable. Now assign this datatable to another gridview as datasource and bind it.
How to remove a textbox and put the dropdown box in asp.net
And the value that is used before in textbox, now it should take from dropdown box
You can use select tag for this. And can get the selected value in C# using the following code
Suppose cmb is the id of your dropdown box, then
cmb.Items[ cmb.SelectedIndex ].Value
can fetch the value selected in your drop down box and
cmb.Items[ cmb.SelectedIndex ].Text
can fetch the text selected
easiest way is to use jquery and jquery.jeditable plugin with it.