Web Forms :: Dropdown To Exclude Or Disable List Items Based On Listbox Selections?

Mar 12, 2010

I have a drop down that lists all our 40+ locations.. I then have a list box with all our locations as well. The client is presented with the question which locations have you worked at before. If they pick say 3 locations, i need to remove or disable those 3 from the drop down. I have other code for creating a drop down, but not sure where to go with this.

Here is my code for the controls and code behind:

[Code]....

View 17 Replies


Similar Messages:

C# - Dispay Specific Items In Dropdown List Based On Condition?

Sep 21, 2010

I have a dropdown list with four options like:

New Reviewed

To be Reviewed Presented

I need to display only specific items in the dropdown list based on some conditions.I mean sometimes with only 2 items

New Review Sometimes with 3 items

New Review To be Reviewed and sometimes all items.How can I do this? I am using C#.

View 2 Replies

Web Forms :: Coloring DropDown ListBox Items?

Sep 29, 2010

I have a situation where some dropdown listboxes contain some items, then there's a separator line, and then there are more items. The ones above the separator line reflect the "commonly used items". To better highlight these I was using code like this to individually color those specfic items:

foreach (ListItem item in ddList.Items)
{
if (item.Value == "-1")
unAssigned = true;
if (!unAssigned)
item.Attributes.Add("style", "color:#5558ff");
}

This code works fine EXCEPT that once a PostBack occurs then the highlighting disappears. The items in the dropdown listbox remain (without repopulation) but not the highlighting.

I'm curious why this is happening and whether there's a way for the highlighting to "stick" short of calling this code from the Page_Load event handler every Postback?

View 2 Replies

.net - How To Disable Certain Items In Listbox Control When Binding

Jan 28, 2010

have an datatable with valuees like this

ListItem ddlItem;
foreach (DataRow dr in dt.Rows)
{
ddlItem = new ListItem(dr["names"].ToString())
lbx.Items.Add(ddlItem);

View 1 Replies

Web Forms :: Disable Dropdown List When One Of Radiobutton List Is Checked

Jan 2, 2013

How to disable two drop downs on checking one of radio button from radiobutton list,,its like radiobuttons with no ID in side <asp:RadiobuttonList> tag. 

View 1 Replies

Web Forms :: Dropdown Lists - Showing Items Based On Value?

Oct 12, 2010

i have over 100 items all loaded in a dropdown list. They all are assigned a value between 1-10 which represent 10 categories. When certain buttons are clicked, i want the dropdown list to display only items with a value "1" or "2", etc.

View 3 Replies

AJAX :: How To Update Listbox Based On Dropdown Value

Mar 15, 2010

I have country dropdown, now on change of its index i need to populate items in listbox (not in the dropdown).

View 1 Replies

.NET Gridview InVB - Enable Or Disable The Textboxes And The Dropdown Listbox If The Row Is Not Selected

Mar 9, 2010

I have a Gridview that has a button at the left hand side representing the row number. The Gridview has two textboxes and a dropdown listbox as templates. I would like to enable or disable the textboxes and the dropdown listbox if the row is not selected. I also need to enable or disable the templates depending on what the value is of one of the cells. When the templates are changed, I need to save the changes.

I have been able to get this working in the RowDataBound Sub but not in the RowCommand Sub when the row is selected. provide an example in VB.My current RowDataBoundSub, which does no work is below:

Protected Sub PropGrid_RowCommand(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles PropGrid.RowCommand[code]....

My current RowDataBound Sub, which is working is below:

Protected Sub PropGrid_RowDataBound(ByVal sender As Object, _
ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles PropGrid.RowDataBound [code]....

View 2 Replies

JQGrid Inline Editing - Filter Subcategory Dropdown List Based On Another Category Dropdown

Jul 9, 2010

I have a category and a subcategory column in a Jqgrid. I have enabled inline editing, both category and subcategory are dropdownlists columns (edittype:'select'). I need to filter the subcategory list based on the selected category. I wonder how can I acheive this functionlity? I tried the below event but its not working for me

afterEditCell: function(rowid, celname, value, iRow, iCol) {
//to do here
}

the above event doesn't get fired. my all column are editable

View 1 Replies

Remove List Of Items In Listbox?

Apr 11, 2010

Im Using asp .net with Vb Coding.

I have to remove the list of selected items from listbox .

Dim i As Integer
For i = 0 To listbox1.Items.Count - 1
listbox1.Items.Remove(listbox1.SelectedValue.ToString())
Next

My doubt is If i run the page again the listbox shows the items which i deleted already.

View 14 Replies

Data Controls :: Filter SqlDataSource Based On Selected Items From ListBox?

Aug 29, 2013

sql data source is easily take one filter expression from dropdown list and filter the data show in gridview.

 How can i filter sql data source through listbox because in list box user can pass multi selected value in that sql data source stop working.

View 1 Replies

Web Forms :: How To Loop Through Dropdown List Items

May 12, 2010

I want to loop thru dropdown list and check the individual list item text using C#, let me know what is the best way to do this?

View 4 Replies

Templates - Populate List Items In Dropdown List From Placeholder?

Feb 24, 2010

I'm designing my own custom control that contains a .NET dropdownlist. What I'm wondering is if it is possible to populate my dropdownlist with listitems placed in a placeholder? For example:

<asp:DropDownList ID="ddlFilter" runat="server" >
<asp:PlaceHolder ID="ListItemPlaceholder" runat="server"/>
</asp:DropDownList>

This doesn't work because the DropDownList control only allows ListItems as child controls. But, I want to do something similar to this so when the user includes my control on a page, they can do something like this:

<mytag:MyControl Mode="DropDown" runat="server">
<ListItemTemplate>
<asp:ListItem Text="C" Value="c"></asp:ListItem>
<asp:ListItem Text="E" Value="e"></asp:ListItem>
<asp:ListItem Text="B" Value="b"></asp:ListItem>
</ListItemTemplate>
</myTag:MyControl>

I know I can do this by dynamically adding the ListItems in the page code behind, but I'd like to avoid that if possible.

View 1 Replies

AJAX :: How To Update Listbox Based On Dropdown Value / Unable To Use Cascadingdropdown

Mar 15, 2010

i have a religion dropdown1 , on this selectedindexchange i have to populate castes into the listbox(not dropdownlist).

i am unable to use cascadingdropdown as it is tightly binded with dropdowns.

please guide me how do i update listbox items based on the dropdown selected value using ajax.

i tried with pagemethods getting the dictionary object using JS function and thought of binding it.

but i am unable to bind the list.

//html code
Religion
<asp:DropDownList ID="ddlReligion_RS" runat="server" TabIndex="6" onchange="GetCastes_RS(this.value);">
</asp:DropDownList>
<br />
Caste
<asp:ListBox SelectionMode="Multiple" ID="lstBxCst_RS" runat="server">
</asp:ListBox>
//js function
function GetCastes_RS(relgnID)
{
abc.BLL.Services.AjaxService.GetCastes(relgnID,
function (resp)
{
var ddlCaste= document.getElementById("<%=lstBxCaste_RS.ClientID%>");
ddlCaste.length=0;
var castesList = resp;
alert (resp);
if(castesList.keys.length >0)
{
for(var i=0 ;i< castesList.keys.length;i++)
{
op=castesList.keys[i];
ddlCaste.options[ddlCaste.length]=new Option(castesList.values[i],op);
}
}
},
function(val)
{
alert(val.get_message());
}
);
}

i could call the webmethod, but i am getting this error in javascript.

Type 'System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]]' is not supported for serialization/deserialization of a dictionary, keys must be strings or objects.

when gone thru few links i have seen few examples supporting dictionary object , why not in my case?

View 1 Replies

Web Forms :: Dropdown List Items In Corresponding Colors Rather Than Black?

Oct 14, 2010

i have a dropdownlist for which i have items like red,blue,yellow,green...etc but these items default static color will be black for all items,

but my requirement is to Red as red color Blue as blue color Green as green color

[Code]....

View 9 Replies

AJAX :: Display Cascading Dropdown List Based On Checkbox List Selected Value

Nov 10, 2010

How can i generate dropdown lists based on what has been selected in the checckbox list. Below is an example of what i need. if the user selects the options day, lotID and waferID, then 3 cascading dropdown lists should be displayed. And then a gridview displays data based on what has been chosen in the dropdown lists.

Day
LotID
SlotID
WaferID
VendorID
ToolID
LocationDetected
ProcessStep
Stage
Precipe
WaferStartMaterial
WaferStartVendor
WaferStartLot
WaferDiameterCOA
WaferMapTitle
BreakPoint
BreakpointSide
BreakpointMeasurement

View 3 Replies

Populating A Dropdown List Based On Value Selected In Previous List (mvc3)

Mar 18, 2011

I'm trying to progam a strongly typed "Create" view using MVC 3 and razor. I want the user to be able to select a customer from a dropdown list (I populated this from my database using ViewBag in the controller). When the user has selected a customer I want a separate dropdown list to generate a list of dogs belonging to that customer related by the customerID in the database. The create button on the form will then take both of these values along with the the other fields and save it to the database.

View 1 Replies

Web Forms :: Is It Possible To Display The Items In A Dropdown List Not By The Order Of Insertion

Jul 7, 2010

Is it possible to display the items in a dropdown list not by the order of insertion?

i want to display the orders alphabetically.

View 3 Replies

Web Forms :: Trying To Populate The Value (s) Of A Listbox That Has Multiple Selections?

Jan 20, 2010

I am trying to populate the value(s) of a listbox that has multiple selections:

Assignment Preference:<br />

<asp:ListBox ID="assignmentPreferenceList" SelectionMode="Multiple" runat="server">

<asp:ListItem Value="">None</asp:ListItem>

<asp:ListItem Value="CONTRACTING">CONTRACTING</asp:ListItem>

<asp:ListItem Value="DIRECT HIRE">DIRECT HIRE</asp:ListItem>

<asp:ListItem Value="CONTRACTING-DIRECT HIRE">CONTRACTING-DIRECT HIRE</asp:ListItem>

</asp:ListBox>

I am using a datareader in code behind to "loop" through the values:

string sql4 = "Select * from assignmentPref where tID=" + (dr["id"].ToString());

SqlCommand comm4 = new SqlCommand(sql4, con3);

SqlDataReader dr4 = comm4.ExecuteReader();

while (dr4.Read())

{

assignmentPreferenceList.SelectedValue = (dr["assignmentPref"].ToString());

}
Works great with 1 assignment preference but with 2 or 3 it craps out.

View 7 Replies

Web Forms :: Picking Random Items From A List Based On Percentages

Jun 10, 2010

I am trying to make a way so that I can have a group with items in it, each one of the items (which is an object in a list) having a double type value, the total of all the items in the group is 100 when you add up all their properties. The purpose of this is that there can be random selection of the items.

for example:

item 1 percent property: 25.0
item 2 percent property: 25.0
item 3 percent property: 25.0
item 4 percent property: 25.0

When a request comes in, I need to be able to pick 1 of these items at the rate of 25% so that after a while (more and more requests) that each of these gets very close to 25%. I have tried looking at random numbers but pulling a number back seems useless in this case because for example if a random number retrieved was the number 5.4, how would I send it to an item? I cannot keep a history of the item requests so that I can factor that in. I need to be able to pick a random number and over time have each of these 4 items be selected an equal amount of times, the percentages and amount of items is going to change constantly but the sum of all the percent properties within a group is 100%. What is the best way to accomplish this in C# with a web form?

View 2 Replies

Web Forms :: Load Time Vs # Items Graph For Dropdown List Boxes?

Jan 20, 2011

I've noticed that page load time increases dramatically as you load up a ddlistbox with items. 10,000 or so results in a pretty much unacceptable wait time for my setup. The dropdown I'm trying to load is Airports - like all of them. What are some alternative UI solutions that give the user the ability to easily select any (literally) airport, but without a ginormous page loading time? (Currently the dd is keyed to the airport's 3 letter code, so it's convenient for the prepared user to just type the 3-letter code and have the right airport selected. The display is then set to code, city, country.)

View 7 Replies

Web Forms :: How To Disable Dropdown List Value In The Current Form That Was Selected In The Previous Page

Aug 27, 2010

I am having 2 web formsand will have a drop down list on those web forms. If i select a value from drop down and click on ok i will get tranfer to next page. In that page i will have a drop down with the same values in the previous form . What i need is i would like to disable the selected value in the previos form and would like to display the remaining normal.

View 3 Replies

Web Forms :: Preselect Item In Dropdown List Box Based On Value

Jun 16, 2010

I am trying to preselect an item in a drop down list box based upon a value I pass in from a data reader. When I place a "Watch" on the drop down list box, the code I am listing below says that it does what it is supposed to and sets the "selected item" to the one I want BUT when the page is rendered and comes up the first item is always selected. It is like it loses the set when the page is loaded or something.

Here is the code....
<td style="width:33%"><asp:Label CssClass="formlabel" ID="lblRU" runat="server" Text="Reporting Unit: "> </asp:Label> <asp:DropDownList ID="ddlRepUnitTeam" runat="server" DataSourceID="SqlDataSource1" DataValueField="MR_LU_TEAMS_PK" DataTextField="MR_LU_TEAMS_NAME"> </asp:DropDownList> </td> <%
For Each item As ListItem In ddlRepUnitTeam.Items
If item.Text = myReader.GetString(0) Then ' ddlRepUnitTeam.Visible = False
item.Selected = True Exit For End If Next %>

For giggles, I add the ".Visible = False" in there as a test and commented it out later. That doesnt work either. The item still is visible. I know the IF statement passes as it enters into the if statement using debug mode and hits the "Exit For" so I know the condition is being met. I am at a loss over this one.

View 8 Replies

User Controls :: Enable Disable DropDownList Items Based On Database Values

Mar 20, 2014

May i know how to create the control function in asp.net  to control the values ?

Based on the DB table, it active is Y then enable values  in dropdownlist , if N then disable the values. 

View 1 Replies

Forms Data Controls :: Order Of The Items In A DropDown List Inside GridView

Sep 22, 2010

I have a DropDownList inside the EditTemplateItem (if the user clicks edit) in a GridView.The DropDownList receives all available rows from the database. My problem is,if the user clicks Edit in the GridView to edit a row and opens the DropDownList Box the original item is not selected but the first one.That means the items are sorted. Have someone an idea how I can solve this issue that the right item / the original is selected if I change to edit mode of the grid view?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved