Dropdownlist With An 'other' Entry Selection?
Mar 16, 2010Asp.net 2.0, C#. Is there a control that if the users does not like the selections on the dropdownlist, they can enter in another value?
View 15 RepliesAsp.net 2.0, C#. Is there a control that if the users does not like the selections on the dropdownlist, they can enter in another value?
View 15 Repliesi have 2 DDL in my page that when users select item from ddldistric1 item in ddlcity1 will change these are my code
protected void DDLcity1_SelectedIndexChanged(object sender, EventArgs e)
{
BindDistrictC();
}
private void BindDistrictC()
[code]...
I am having two dropdownlist in my project,one dropdownlist for empid, another dropdownlist for month, if the user select the empid, the values are retrieved in the textbox.
In the second dropdownlist, if the user select the month in the dropdownlist it will display the leave details, its all working fine, if the user again select the first dropdownlist that means empid, I want to show the second dropdownlist as select month, how can do this.....
i have 3 drop down list in my page
1-ddlzone1
2-ddldistrict1
3-ddlstore1
this is ddlzone1 code
protected void DDLzone1_SelectedIndexChanged(object sender, EventArgs e) {
DDLstore1.Items.Clear();
DDLstore1.Items.Add(new ListItem("select center", ""));
DDLstore1.AppendDataBoundItems = true;
SqlCommand _cmd = new SqlCommand("selectcenter", _cn);
[CODE].....
This is the Grid am using ....
[Code]....
Every thing is working fine ....
Wat i did is in the first header of gridview dropdownlist i have binded the PO Item , so that user can select item n make invoice...
Here the problem is user will click addnewrow button to create new row second row , again user is able to select the same item what he selected in first row of gridview. here how to avoid duplication in the second row .
Say i have four PO item
Item1,Item2,Item3,item4
user may select Item1 in first row , after clicking addnewrow button user will get second row
here again user is able to select Item1 from dropdownlist ... how to avoid duplicate selection
coz the dropdownlist is binded from database using sqldatasource n filter based on user selected PO no.
Duplicate Item selection should be removed until all the four item is selected ...
I have a dropdownlist on my page with dates such as 1/1/2013, 2/1/2013, etc.
Then there is a second ddl.
If the date in ddl #1 is before 1/10/2013 I want to enable ddl #2.
If the date in ddl #1 is on or after 1/10/2013 I want to either disable ddl #2 or hide it (whichever's easier).
Disabling ddl #2 based on the selected date is a new requirement so I am enhancing the existing code. Obviously I want to do this without a postback, but I don't know what is the best way. I am trying to understand what an AsyncPostBackTrigger is because this is the existing code:
Code:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:dropdownlist id="EffectiveDateDropDown" runat="server"></asp:dropdownlist>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="QuoteType"
EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
It wants to do something when the selected index is changed? This exists in the code-behind, but I set a breakpoint and never hit it:
Code:
protected void QuoteType_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
}
catch (Exception err)
{
this.PublishError(err);
}
}
I thought this would be very simple but I can't get it. I have a dropdownlist bound to a datasource in order to produce a list of items. At the top of the ddl, I want a 'NEW ITEM' entry. It's not showing up.
[Code]....
[Code]....
I have 2 dropdownlist, one is to dropdown department, and another dropdown staffnames. the secong dropdownlist will based on the selection of department as each department has different staffs i have 2 tables department and staff in my database , in my department table i have departmentid as PK and departmentname, in my staff table i have staffname and departmentid as FK. So my ques is how am i going to populate staffname in the dropdownlist according to the selection of department.
View 9 RepliesI have one table which contains branch codes(primary key), Branch name and bank name columns. I have 3 dropdownlist boxes. the first dropdownlist is for the branch codes. When i select the a branch code i need the second dropdownlist box to populate with the appropriate branch name and the third dropdownlist box to populate the bank name at the same time.
Is it possible to have one table like mine and acheive this, if so how do i go about doing this?
I did read up on this but only came across ones with 3 tables.
I am using Visual Basic to do this.
I have a form written in C# with a SQL database to hold the data. At the end of the form, there is a DropDownList control that is blank upon the initial entry. If a user selects anything in that drop down box, upon saving the form, a new form with the same format will be created and the last form will be locked for editing. I have no idea on how to implement this or how to start on this.I'm kinda new to ASP.NET so bare with me please.
View 8 RepliesIn my project requirement user wants to enter a manual entry if they can not find an item in the drop down list.
Right now what I am doing is:
I set the dropdown list autopost back true and on selectedchanged event I am hiding the drop down list and showing a text box to enter a manual entry...
This is working perfect and no problems..
but the drop down list needs to change to a text box on only selecting a "unknown" option in the list...all other list items are doing unnecessary post back to the server with no use...
I have a TextBox1 and a Search button in my application with this following code:
protected void Button1_Click(object sender, EventArgs e) {
Response.Redirect("~\searchpage.aspx?PatientNRIC=" + TextBox1.Text); }
Which means, if the user type ONLY IC NO:S1234567D, then when click it will show the patient detailview. So I now I'm doing almost the same thing but now I have a TextBox2 and a DropDownList1. Inside DropDownList1, I have "Name", "IC No", "Test_Date". So for an example, I type "S1234567D" in the textbox1, and I choose "IC No" in DropDownList1 it should redirect me to a page of the S1234567D's patient detailview. How could I do my code?
I have a dropdownlist and id like upon selecting one of the four choices to set the imageurl of Image2 in code behind?
View 3 Repliesi want the code to disable default selection in dropdownlist in asp.net and also on selection of a particular data field the values are displayed in the txtbox below.the dropdown should be filled with system related data like eg c:drive, d ... etc dynamically at run time.
View 2 RepliesI have a page that searches and displays records. Users enter a record number and then select the type of record to display from a dropdownlist control. They then edit some data on the page, and the app does some calculations based on the type of record that is selected from the drop down. How do i get to successfully pass the value from the dropdownlist to the method that does the calculation to ensure that the right formula is used? Here is the code that I currently have.
[Code]....
then the code behind to do the calculation looks like this...
[Code]....
After stepping through the code, i noticed that when it gets to the "foreach" block, the value selected by the ddlRecordType dropdownlist is always the default which is "select one" and not any of the other selections that might have been selected.How do I get this to work, so that it can maintain the value selected from the dropdown and used in the code behind?
[Code]....
I have an EditTask View for editing the following properties for a Task that I am modeling.
[Task Name]
[Project Name]
[Assigned Employee]
Task Name and Project Name are just simple text boxes.
I want Assigned Employee to be a selection from all the available Employee's currently in the database. Dropdownlist is not really an ideal option because there could be hundreds if not more possible employees.
I'm thinking a link to show a select employee grid listing in either a popup or another page where filtering can take place (b/c employee has other properties such as Dept) and the selection is made and the EditTask view is updated would be ideal but not sure. I'm new to ASP.NET MVC so I'm a little lost on where to start to implement this.
What is the best way to handle this UI scenario in ASP.net MVC?
1) 1 dropdownlist - department
2)Search button
3) 1 listbox that will display all the staff according to the selection of its department
So when i select the department and click search button, the listbox will be populated with the staff names.
I have a DDL and ASP.NET Textbox. I would like to populate the text box with the option I choose from the DDL. I need this to be instant and not use postbacks so it would seem JavaScript would be the obvious choice here. I have done quite a bit of searching but everything I have found seems to be for standard HTML (Selects and Inputs) and these do not appear to work with ASP objects:
<asp:DropDownList runat="server" ID="DDLSalesPerson" DataValueField="keyid" DataTextField="FullName" />
<asp:TextBox runat="server" id="txtSalesPerson" />
My DDL is populated from SQL in the code-behind page.
I have two ListBox in my ascx file, I fill them with some data (no problem here), I make them multiple and increase the size, below is my code.
[Code]....
I use some jQuery code to exchange element between them (Here too, no problem). My problem begin when I post my form, I'm unable to get the data from the DropDownList with attribute multiple or size. I tried in my controler to add a FormCollection parameter, I can see every element in my form except those select tag with more options than id and name. I tested to put a manual select tag in my code with only an id and a name then add size and multiple attribute, when there is only id and name I can get the value but when there are more I can't get my select tag in the FormCollection
Also I need to get all the value in the ListBoxand not only the ones who were selected. I have been searching answer for 2 fays now... Without success, I only find resource on how to show ListBoxbut not how to get values from them in mvc web site and I don't find any resources who talk about multiple selection ListBox, I think I'm a bad searcher but....
I've got two DropDownLists that are filled using a couple of SqlDataSources, like so:
[Code]....
The third DataSource, dsCriterias, is used to present a set of dynamically added DropDownLists depening on what's selected in the second DropDownList, subcategories. The set of dynamic DropDownLists are presented using this code:
[Code]....
The code works but there's little thing that's bugging me. When the page is first loaded the criterias belonging to the subcategory is not presented. I expect it to show the criterias but ther won't show until I make a choice in the categories-DropDownList meaning if I wan't the first subcategories criterias I have to choose different subcategory and then go back to the first one. It's a bit hard to explain.
An example: When the page is first loaded I get a category presented, eg. Vehicles. In the subcategories I get the alternatives "Bicycles", "Cars" and "Motorcycles". "Bicycles" will be the one presented when the page loads since the stored procedure used by dsSubcategories sorts the data by the subcategory names. The problem is that I don't get the criterias for the "Bicycles" subcategory at page load. To get them I first need to select "Cars" or "Motorcycles" and then choose "Bicycles".
I've tried putting a subcategories.SelectedIndex = 0 in in the OnLoad but nothing seems to do the trick.
I am building a custom control that mimics a dropdownlist with my own custom items in it. I'd like to figure out how after selecting something, the text changes to what was selected.
I can do it with javascript but looking at the html source of a dropdownlist, there is no javascript there to modify the textbox/label.
I've created following View, which contains simple text box and Submit button. On submit button I've simply filtered records having product name as written in textbox. As I'm new to MVC 2, I'm not getting whats wrong with my code (specially with my UserControl)..?
[code]....
Now my datasource has where clause depends on the selection of a dropdownlist that contains selection of one of the items plsu and option ALL.
This only caters for all or, one item
I need to make it
All, or, 2,3, or 4.. selection and the datasource is then refreshed. What control I should use and it seems the SQL need to modified into "IN" statement, am I wrong ?
I have an asp.net page which has a panel with default button and update panel and dropdownlist inside the update panel. While I fill the form when I select an item with up/down keys and press enter to select it the form is being submitted. How can I fix this?
EDIT
Some code:
<asp:SqlDataSource ID="sdsCountries" runat="server" ConnectionString="cs"
SelectCommand="SELECT CountryID, Title FROM Countries"/>
<asp:DropDownList ID="ddlCountries" runat="server" DataSourceID="sdsCountries"
DataValueField="CountryID" DataTextField="Title" AutoPostBack="True"
OnSelectedIndexChanged="ddlCountries_SelectedIndexChanged"/>.......
I have already spent two day to solve this on my own but for some reason I can't. Maybe I'm missing the live cicle of the dropdownlist. I hve a three dropdownlist that filter a gridview and the other two dropdownlists One is "Year" the other is "Country" and the other "Species" Each one of them is filter by the other two. So if I filter for one year it will only show me the species and countries that have records on that year. So I have to reload the gridview and all the dropdownlist.
What happend is that since I'm filling again the dropdownlist with less values he can't remember the previous one. I have tried with the events: DataBinding, Load Unload and Init of the dropdown list to force it to remember. The conclusion I have reach is that the databinding and the load have the dropdown list of the previous page. So if I do
String strYears = ddlYears.SelectedValue.ToString();
ddlYears.SelectedIndex = ddlYears.Items.IndexOf(ddlYears.Items.FindByValue(strYears));
And the year was on the index 4 but after changing the country the year is now index 3 he mantains the index 4 showing me another year.............................