ASP.NET dropdown to combobox - c#

I have a Part Number field displayed as drop down list in my ASP.NET webform.
User will select part number and System will store the respective ID from part table.
Since this is dropdown list, user is not able to type the part number. I want to use a combobox so that user can enter the initial few digits, and then suggestions will pop up like in a dropdown list. Also I want to show error is the entered value by user is not in the database.
I am currently using asp-for and asp-items tag helpers to show data in dropdown.
Is there a way I can get to display combobox instead of dropdown list?
Thanks!

The Answer to above question can be found here:
Link: How to get the values of multiple choose dropdown box
Add the jquery Script from above link. for Select tag, use class as : multiple class="chosen-select" and finally add below script to show default value when input doesn't exist in database.
<script>
$(".chosen-select").chosen({
no_results_text: "Oops, nothing found!"
});
</script>

Related

list large numbers of items in dropdown asp.net c#

I have currently implemented a drop-down which displays all the products name from database. On selection of product name from drop down my edit product form will get populated and user can update selected record successfully.
Now my problem is that i have 5000 products in my database.In this case its very difficult for end user to select particular product in drop-down and also populating drop down with large number of records server side takes more time.
What approach should i use to make selection user friendly.Any ideas or help is greatly appreciated
Thanks!!!!
You should use an editable combo box with auto complete feature and load the data depending on user input. Refer this: http://www.asp.net/AjaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx
This way you dont need to worry about the amount of data, it gets filtered as the user inputs some string.

cascading dropdown list for custom field in kentico cms

I have added two new custom field in CMS_USER table.
Both filed is integer type and Form control is Drop-Down list type.
currently both dropdown list is filled by SQL query in Editing control settings.
I want to implement functionality as when user select any value from first dropdown list than second dropdown list will fill according condition of selected value of first dropdown.
second dropdown list will fill on first dropdown selected index changed.
How can I do this.
Path is as Administrator login - >CMSSiteManager-> Administration -> Users -> edit user-> Custom field.
First dropdown is CompanyName and second is CompanyAddress
Any help is appreciated.
The only think that comes into my mind (if you don't want to create custom controls) is that macros are being resolved within SQL queries. So it should be possible to use following
SELECT AddressID, AddressName FROM TableWithAdresses WHERE AddressCompanyID = {% EditedObject.GetValue("CompanyID") %}
as a query for second dropdown list. Use integrated SQL debug (CMS Site Manager -> Administration -> System -> Debug -> SQL debug) to see what is happening.
You can try custom form control.
see http://devnet.kentico.com/docs/5_5r2/devguide/index.html?developing_form_controls.htm

clear table data in a partial view on text box focusout event

I have a partial view (dynamic) which has a select list in one of the columns. I use Jquery to populate this list based on what is entered in a text box.
Anytime a user changes input in that text box, I want to clear the data from the table. Hence I tried the following options:
$("#StudentTable tr>td").detach();
$("#StudentTable tr>td").remove();
$("#StudentTable tr>td").empty();
But I get an error:
'get(...).options' is null or not an object
on this line:
$("#TeachingAssistant").get(0).options.length = 0;
Here, "#TeachingAssistant" is the select list "id" in the partial view.
<td>
<select name="TeachingAssistant" id="TeachingAssistant"></select>
</td>
I suppose it is deleting my the select list and hence not identifying it. How should I approach this? Any other way to clearing table data?
Thanks in advance
$("#StudentTable tr td").html('');
will empty every td on your table, but if you have binded any events in any td content, you may have some problems!
to clear the select options you can use this:
$("#TeachingAssistant option").remove();
Try following jquery code (ver 1.0) to delete the html inside table '#StudentTable':
$("#StudentTable").html("");
OR
$("#StudentTable").empty();
For reference you can visit link : jQuery - html()
For geting the selected valus from dropdown use following code:
$("#TeachingAssistant").val();
For clearing:
$("#TeachingAssistant").val("");
For reference you can visit link : jQuery - Get value

Getting a value in a textbox from a dropdown list

I have a textbox named textbox1 and a dropdownlist. Dropdownlist contains the list of branches and i want that when i select a branch from dropdown i want to get the respective branch code to be generated in a textbox from the Database or from c# coding. How will it be possible ?
Am I missing something, is it more complex that just putting an event handler on the dropdown so that when it's value changes it calls your method that can do whatever it needs to do to generate the string for the textbox?
Skipping passed the "database" portion of your question (and assuming your data isn't bound to the DropDownList)..
One way in ASP.NET, to accomplish this, I believe, is to have your code print DropDownList.SelectedValue's value in the textbox during an event.
Here is a link showing how to bind an event to DropDownList in jQuery

XtraGrid with unique values filter

I am using XtraGrid in my application. Now, I want to display only Unique values for particular column when user will click filter button. I want to display this list check box items initially all checked. Also I want the information that what items user has selected/deselected from from checked list box.
Any idea?
I think you need to implement a custom filter dialog, as described here:
http://documentation.devexpress.com/#WindowsForms/CustomDocument698

Categories

Resources