How to remove a textbox and put the dropdown box in asp.net - asp.net

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.

Related

Select checkbox of gridview with keyboard in asp.net

I am using GridView on my page, which retrieves data from SQL database.
The first column is named OK and has a Checkbox in each row.
I want to select each check box with the help of keyboard instead of mouse.
The shortcut for toggling a checkbox is the spacebar, so as long as you have the checkbox highlighted, you can use that to check each box.
Next, check out some articles on adding GridView keyboard navigation:
GridView column and row navigation using up/down/right and left arrows
GridView Rows Navigation Using Arrow (Up/Down) Keys
GridView Up and Down Navigation using jQuery

Removing drop-down arrow from a Lookup Field on an Access form

I know this is a low level question, but I am "annoyed" that on my forms which are for read only purposes, i cannot figure out how to remove the drop down Arrow box on fields which are linked to a list of records..
Does anyone know if this can be done??
If you have a Lookup Field in Access and in the Design View of a form you drag it from the field list onto a form you'll get a Combo Box control. Combo Boxes have the little drop-down arrow tacked onto the end.
To get rid of the drop-down arrow simply replace the Combo Box control with a Text Box control. That is, create a Text Box control on the form and set its Control Source property to the name of the lookup field, then delete the Combo Box control. The Text Box control will display the selected value(s) of the lookup field but will not allow you to edit them.
There is an easier method than Gord Thompson's. This is in Access 2010 and may be applicable to other versions. In either Design or Layout View, right click on the combo box control and go to "Change To" then select text box.

Editing an asp.net DropdownList

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..

Get Text from dropdown

I have one page which has Only one Dropdown name called "MydropDown".My submitted form i can get value of selected dropdown by
HttpContext.Current.Request.Form["MydropDown"];
but i need Text not value how can i get this
Plz help me on this
If its not a control, there is no way to get the text other than put the text into the value field.

how to make an checkboxlist select only one item selected

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");
});

Resources