Forms Data Controls :: DropDownLists With ControlParameters That Reference Each Other?

Feb 15, 2010

I have two DropDownLists, and each one has a Control Parameter that references the other.

The idea is that if you select a value in either one of them, it restricts the possible values you can select in the other. And the user may select either one of them first.

Each one has an "All" option for selecting all values. (They are both used to restrict rows that populate a GridView).

This is all done using SQLDataSources.

The problem is that it doesn't seem to work at all. Both DropDownLists are empty, and the SQL that populates them never hits the SQL Server. But there is no error displayed.

If I have it going only one way, it does work, so I think the problem is the recursive nature of having them reference each other.

It would seem to be quite a common requirement, so its there any way of getting this to work?

View 5 Replies


Similar Messages:

Web Forms :: Changing Index On Dropdownlists Childs Don´t Cause Other Dropdownlists To Reload?

Jan 30, 2011

i have the following code:

[Code]....

3 nested dropdownlists SELECTing from DB. So i select the brand, then i select the model and then i select the product and click on SEARCH button.

But when i select thebrand, and then the model, and if i want to change the brand, it does not reset the second and third dropdownlists.

View 3 Replies

Forms Data Controls :: Not Getting Filtered Results In Dropdownlists

Jul 22, 2010

am having three dropdownlists on my webform. On the based on their selection I am retriving records from a databas table. my code for retrieving records as follows.when I didnt select ant dropdownlist ans click the search button then it featch all records. but when i select an option from suppose i select from ddlDivision, even there is many records related to selected Division but it shows sorry no record found.

View 4 Replies

Forms Data Controls :: DropDownLists, Carry Over Values, C#?

Apr 13, 2010

I have a FormView in InsertItem that contains one DropDownList linked to a Table Datasource to display ItemCodes. In that "lookup" table I also have a Retail and Cost field.When the user selects the item from the drop down, how can I have these to field carry over into my new record that is being inserted. The new record also has a Retail and Cost field that are TextBoxes.Basically I am populating the new fields with the default values from the DropDownList.

View 1 Replies

Forms Data Controls :: Filtering Using Three Independent Dropdownlists

Jan 28, 2010

I need to filter data in a View using three dropdownlists that are populated independently of one another. The items in the second ddl are not based on the items in the first, etc. Each ddl is populated using its own sql statement. I want to be able to use each of these dropdownlists independently of the other two, but I want the data that is returned to be based on the values already in the other dropdownlists when I make a selection change.

For example: DDL1 is populated with Horsepower values from its own SQL statement.

DDL2 is populated with Gallons per Minute from its own SQL statement, unrelated to what is chosen in DDL1.

DDL3 is populated with Diameter values from its own SQL statement, unrelated to either of the other DDLs.

I want to be able to make a selection from any of the DDLs and filter data based on the selection, and whatever the current value is for the other two DDLs.

I'm coding in C# and I think I may need to create a delegate and an event to listen for when the SelectedIndexChanged event fires on any of the DDLs. This is slightly more complicated than anything I've coded up to this point, I'm a beginner, and I'm not even sure I'm aiming in the right direction for a solution.

View 8 Replies

Forms Data Controls :: Filtering GridView Using Two DropDownLists?

Jun 9, 2010

I want to filter my gridview using two parameters that come from Dropdownlists. I bind these drops with two linq queries and next I would like to filter my gridview with query that has two parameters that comes from selected values from those drops. Everything is inserted in UpdatePanel. Here is my code:

asp:UpdatePanel
ID="UpdatePanel1"
runat="server"
>

[Code]....

I don't know how to get selectedvalues from dropdownlist and pass them to Bind() function which binds grid view

View 3 Replies

Forms Data Controls :: Large DropDownLists In GridView?

Jan 5, 2010

I have a gridview that is currently showing 20 lines per page. Each line has several fields in it, three of which are dropdownlists. These dropdownlists are populated with a SQLDataSource and then the selected value is bound to one of the gridview datalements.

The problem I'm running into is that the page is very slow to load. I believe this is because of the large dropdownlists (and possibly because there are roughly 60 of them, each of which is executing a SQL query to populate the list of available values). The file size that is being transmitted over the web is just over 1.25MB in size, again from the large amounts of data in the dropdownlists.

Is anyone aware of a technique by which I could only execute the query from the SQLDataSources that populate the dropdownlists' available values once and then reuse the results of that query to populate the relevant dropdowns? Ideally I would do this on the client side so it would also limit the amount of text being transmitted to the client browser.

View 7 Replies

Forms Data Controls :: Gridview With Dropdownlists And Label

Jan 27, 2011

I have a gridview with 4 dropdownlists and 1 label in each row. Suppose , text fields of each dropdownlists are a,b,c and value fields are 1,2,3 respectively.

In each row,label text is the sum of value fields of selected text fields of 4 dropdownlist.

For example,If selected text of 4 dropdownlists of a row are-b,a,b,c.

Then the label text of that row will be 8.(value field of b=2,a=1,c=3 , so b+a+b+c=8)

Whenever the selected text of any dropdownlist changes,corresponding label field also will change.

How can we do this in asp.net with C#?

View 9 Replies

Forms Data Controls :: Populate Dropdownlists Within A Listview?

Jul 28, 2010

I'm comfortable populating dropdownlists in a standard webform, but I seem to be having trouble populating them from within a gridview or listview.I know that I'll probably need to use the find control method, I've had a stab at it with the following:

[Code]....

The purpose of this is to allow someone to look at a bunch of records, and in a dropdownlist add an item to a group, but this "group" is in a separate table, so I want to take whatever value that select in the dropdown menu, lookup their user id, and add both bits of information to the other table, so it's technically not even editing, even though i suspect I'll need to use the edititem template?

View 6 Replies

Forms Data Controls :: Cascading DropDownLists In DetailsView?

Sep 10, 2010

Here is the case:

I use Visual Studio 2008 ASP.NET 3.5

I have a DetailsView control with several fields that is in insert mode. Three of them are the source of my problems and headaches.

I have three DropDownLists in template fields.

The first one is OK, bound to it's designated field in table1 in the database. The next two however have to change their bound tables according to the SelectedValue.

So far, I've managed to get it working, BUT when I insert the data I've entered, these two DropDownLists are not entered into the database.

DropDownList3 - the list that controls the other two DDLs

DropDownList4 and DropDownList5 - the list that need to change their items accordingly

DropDownList3 has six different values, so I have 6 tables for each of the other two DDLs

However I have only tried with one to see if it would work, that's why the Sub seems incomplete.

Here is the relevant part of the code:

[Code]....

And the DropDownList3_SelectedIndexChanged sub:

[Code]....

If I leave SelectedValue='<%# Bind("shelves") %>' and SelectedValue='<%# Bind("type") %>' in the <asp:DropDownList> tag of the two DDLs that change values, I get an error when the first one does the postback.

The error is:

Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. This error, I spent a whole day looking through forums and knowledge bases, but I could find nothing that solves my problem. Maybe the problem is me, but my boss wants this done, despite it is not my area of expertise to write code.

View 6 Replies

Forms Data Controls :: Displaying Gridview Containing DropDownLists?

Oct 15, 2010

On one of my pages I display a Gridview. This contains a list of questions generated by a SQLDataSource, with a dropdownlist on each row containing the answers for that question. The answer values can be different depending on the question, so I populate them in the RowDataBound event for the gridview, using question information.

As the list of questions is longer than the page I have placed the gridview within a Div which allows me to use scrollbars to navigate the gridview. I also use some methods to preserve the location of the last question answered - so that on answering a question, the gridview does not reset to show the first part of the gridview.

This works fine for IE7, which is what I have been using for the development, and which part of my customer base uses. However, the other part of my customer base uses IE6, which causes a problem.

When an IE6 user attempts to answer some questions, they run into issues. Should they scroll down the gridview, when they select a value from a dropdownlist (Effectively, when they answer a question), there is a postback and all of the visible (i.e. onscreen) dropdownlists appear to be cleared. However, on mousing over any of the dropdownlists, their value is then shown. On using either the scrollbar, or on using the mousewheel to scroll the gridview, all the dropdownlists are 'refreshed' and their values are shown.

At no point does the application appear to lose the data, it is just not showing it until there is a mouseover or the gridview is refreshed. Another odd aspect of this is that this does not apply to the first 5 rows of the Gridview. Any of these can be altered without there being this display issue. Should the gridview be scrolled enough to show some of the first 5 rows and some subsequent rows, only the subsequent rows will have this display issue.

I have tried various things to correct this - originally I called my retrievescrollposition method on the SelectedIndexChanged event of the dropdownlist, but have since moved it to Page_Load as the Else branch of if (!IsPostBack). I tried rebinding the DropDownlist in the SelectedIndexChanged event, but this only helped with the Question I was answering - the display of any other onscreen questions was still affected.

View 1 Replies

Forms Data Controls :: Making Gridview Respond To 2 DropDownLists?

Mar 11, 2010

I have got 2 Drop Down Lists on my Form and 1 GridView. I want GridView to display the data according to selection from the Drop Down Lists.

For Example, One Drop Down List contains Names and other contains Dates. Both the Drop Down Lists can post back. So if i select a name from 1st Drop Down list, the Grid View should show all the results according to that Name. Similarly if i select the Date from the other Drop Down List , the Grid View should show the results according to the dates. But i cant figure out as how to bind Grid View to respond to 2 Drop Down List.

BTW i am binding both the Drop Down Lists and the Grid View to the DataSource Objects, which is getting data from the database.

View 12 Replies

Forms Data Controls :: Disabling A Column Of Dropdownlists In Gridview?

Oct 20, 2010

I am filling a gridview with data.

column 1 is a dropdownlist <ddlGrade>

column 2 is a checkbox <cbxNeverAttended> not visible

column 3 is a textbox <tbxLastDate> not visible

in the 'GridView_RowDataBound'

i determine if a ddlGrade value already exists and if so, make it selected in the dropdownlist

also, if the value of ddlGrade is a "U" I make cbxNeverAttended and tbxLastDate visible

However, if cbxNeverAttended or tbxLastDate are both empty strings (and ddlGrade has the value "U"), I want to disable all instances of ddlGrade in the gridview (essentially forcing the user to enter a value for cbxNeverAttended or tbxLastDate before moving on to enter another ddlGrade).

But I have been unable to figure out a way to accomplish this on the 'Gridview_RowDataBound',

View 1 Replies

Forms Data Controls :: Bring Data From Dropdownlists To Datagrid?

Jul 12, 2010

I have two dropdownlists and one datagrid...I want to bring data from dropdownlists to grid.After selecting items in both the dropdownlists , I want to add the two selected items from dropdownlists in a datagrid row in two diffrent columns.And I want to add next selected data from the two dropdownlists to the second row of grid and so on.

View 5 Replies

Forms Data Controls :: Implement A Form Of Cascading Dropdownlists And Associated Controls?

Dec 4, 2010

I've got 3 SqlDataSource controls, and 2 dropdownlists and 1 detailsview on a page. The first SqlDataSource is associated with the first dropdownlist, and second SqlDataSource (which is filtered based upon the selection chosen in the first dropdownlist) is associated with the second dropdownlist and the third SqlDataSource (which is filtered both by the selection of the first dropdownlist and the second dropdownlist) is associated with the detailsview. The idea is the user selects something in the first dropdownlist, and it is supposed to update what is returned by the second SqlDataSource control and second dropdownlist, and that in turn is supposed to change what is returned in the third SqlDataSource control and it's associated detailsview. All of the dropdownlists have AutoPostback set to True.

View 11 Replies

Web Forms :: ControlParameters To An LDS And That Famous Error?

Jan 5, 2011

I am trying to capture some user input and add it into a database. Here is what I have: { CreatePost.aspx }IMG]http://i56.tinypic.com/n2ijgz.jpg[/IMG]And here is my code in the code behind file { CreatePost.aspx.cs }:

[Code]....

I have also went ahead with PeteNet's advice and added this to my web.config:

[Code]....

However I am still getting that famous error:A potentially dangerous Request.Form value was detected from the client (ctl00$content$txtBody="<p>Hello. This is ju...").I would greatly appreciate any help in sorting this error out.

View 12 Replies

Forms Data Controls :: Multiple Dropdownlists Search Show In Gridview?

Jul 6, 2010

hope you guys are doing well! I have a question and no answer yet how to do it. Right now i can have 1 dropdownlist and when i press on my search button its show the result of the query the user ask

but how to do it with two seperates dropdownlist ? isnt it with inner join ? also if the value is null what to do ?

here is my sample little code for a sample search

[Code]....

View 1 Replies

Forms Data Controls :: Multiple Dropdownlists Not Holding State After Response Redirect?

Nov 11, 2010

I hope somebody can guide me to overcome below challenge.

My form has three dropdownlist controls and one listview. Everything works fine if I don't try to pass multiple querystrings to get different URL on the same page. But challenge comes when I try to pass multiple querystrings to show different URL's for SEO.


Following are the ID's:

1. DropDownList1= Country

2. DropDownList2= State

3. DropDownList3= City

4. Listview1= Resturants (I am not including Code .....yet)

With my code DropDownList1 holds the state and passes the value to URL OK .When I try to select
different value in DropDownList2 or DropDownList3 are able to
pass the vaule to URL but in the form they stay on the first item and doesn't change and so does Listview1.

Here is my code:

<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (false == IsPostBack)
{
if (Request.QueryString["Brand"]!= null)
{DropDownList1.SelectedValue = Request.QueryString["Country"].ToString();}
if (Request.QueryString["Gender"]!= null)
{DropDownList2.SelectedValue = Request.QueryString["State"].ToString();}
if (Request.QueryString["Category"]!= null)
{DropDownList3.SelectedValue = Request.QueryString["City"].ToString();}
}
}
protected void DropDownList_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect("/resturants.aspx?State=" + DropDownList1.SelectedValue + "&State=" + DropDownList2.SelectedValue + "&City=" + DropDownList3.SelectedValue);
}
</script>
<head></head>
<body><form id="form1" runat="server">
<asp:DropDownList id="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource2" DataTextField="Country" DataValueField="Country" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [Country] FROM [Country] ORDER BY [Country]">
</asp:AccessDataSource>
<asp:DropDownList id="DropDownList2" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource3" DataTextField="State" DataValueField="State" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource3" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [State] FROM [table] WHERE ([Restuarant NAME] LIKE '%' + ? + '%')">
<SelectParameters>
<asp:controlparameter ControlID="DropDownList1" Name="Restuarant_NAME]" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>
<asp:DropDownList id="DropDownList3" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource4" DataTextField="City" DataValueField="City" ForeColor="#808080" OnSelectedIndexChanged="DropDownList_SelectedIndexChanged" >
</asp:DropDownList>
<asp:AccessDataSource ID="AccessDataSource4" runat="server" DataFile="../database.mdb" SelectCommand="SELECT DISTINCT [City] FROM [table] WHERE (([State] = ?) AND ([Resturant NAME] LIKE '%' + ? + '%'))">
<SelectParameters>
<asp:controlparameter ControlID="DropDownList2" Name="State" PropertyName="SelectedValue" Type="String" />
<asp:controlparameter ControlID="DropDownList1" Name="Resturant_NAME" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:AccessDataSource>

View 1 Replies

Forms Data Controls :: Listview 3.5 Bind Dropdownlists Edit Item Template VB.NET

Aug 25, 2010

I am trying to do this with many issues of data binding doubling the amount and not setting selectedValue on dropdownlist. I have read some posts and they help but I am missing a crucial piece. My problem is that my dropdownlist is doubling the amount of records for the dropdownlist. Instead of "YES;NO;SELECT A VALUE", I am getting "YES;NO;SELECT A VALUE;YES;NO;YES;NO". My database is correct with the UPDATE part but the rebind after update is failing horribly.

[Code]....

View 4 Replies

Forms Data Controls :: Populating Dynamic Dropdownlists / Only One Call To Database For All Dropdowns Rendered

Mar 8, 2011

I have a page with a data repeater. Each row has a dropdownlist for the user to select a value and the values in every dropdown are the same. I also have an SqlDataSource which each dropdownlist gets its values from as its created. Everything is working as it should but for each dropdown that is rendered a seperate call is made to the database.

suggest a better way for me to do this that means only one call to the database for all dropdowns rendered?

View 3 Replies

Data Controls :: Populating GridView With Two DropDownLists

Sep 11, 2013

I have two dropdown lists that I am using to filter a gridview.  I gridview is populating based on a query

select [AnnotationNumber],[AnnotationBy],[AnnotationType],[BusinessUnit] as Unit,[ErrorType],[ActualAgencyError],AnnotationComments,[sgkComments],[ActualAgencyError],Cust from vw_GridviewSource where Name = '"+@Name+"' and AnnotationDate = '"+@Stage+"'";
SqlCommand cmd = new SqlCommand(query);
gvSummary.DataSource = GetData(cmd);

The @Name and @Stage variables are the selected values of the dropdownlist. When I start I get the two drop down lists on my webform. When I select the values from the dropdownlists, nothing happens. I get no gridview. I added onselecedindexchange event both dropdownlists and even after both are selected nothing. I debugged the code and found that there is a point where the value is correct, but I still don't see the gridview. I have alsochecked the query associated with the databind and it works perfectly when I check it in SQL. I am enclosing all the code from the aspx.cs and aspx.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Trakker.aspx.cs" Inherits="AnnoTracker.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">

[CODE]..

View 1 Replies

Data Controls :: Two DropDownLists Change Second One As Per Selection Of First One

Dec 26, 2012

i have two dropdownlist i want to make it as when i select the first one the second one should change accordingly

View 1 Replies

Data Controls :: Creating Cascading DropDownLists Without PostBack

Aug 12, 2012

I have 2 dropdown list in my page these are my code

<asp:DropDownList ID="DDLzone1" runat="server" CssClass="DDlzone" OnSelectedIndexChanged="DDLzone1_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
protected void DDLzone1_SelectedIndexChanged(object sender, EventArgs e) {
DDLstore1.Items.Clear();
DDLstore1.Items.Add(new ListItem("select shopping center", ""));

[Code] ....

When users click on DDLzone1  value of DDlStorre1 will change 

Here for both ddl i set autopostback ="true"  for this it change ddlstore when page is post back 

I want when users click on DDLzone1 value of DDLStore1 be change without loading page again ...

View 1 Replies

Data Controls :: DropDownLists - String Or Binary Data Would Be Truncated

Mar 4, 2013

I have 2 DropDownList and 1 button  in admin.aspx page

1=DDLtradeO and 2=DDLclassO

users should select Item from both of them I use RequiredFieldValidator for both of them and when they click on button in HOuse_info Table it insert their data here when users select first item from DDLtradeO  (that text is="State" )

{ DDLclassO.Enable=false}

below is code

<asp:DropDownList ID="DDLtradeO" runat="server" CssClass="DPCDDLs" AutoPostBack="true" OnSelectedIndexChanged="DDLtrade_SIC">
</asp:DropDownList>

and behind code

protected void DDLtrade_SIC(object sender, EventArgs e) {
if (DDLtrade.SelectedItem.Text != "State") {
BindTrade();
DDLclass.Enabled = true;
Rfv11.Visible = true;
} else {
DDLclass.Enabled = false;
Rfv11.Visible = false;
}

here RFV11 is RequiredFieldValidator for DDlclasso..problem is here when users select other item from DDltradeO and they select Item form DDLcalssO when they click on button it insert data into House_info table correctly but when they select "STATE" Item from DDLtradO (they can't select Item from DDlcalssO) when they click button this error occurrence Server Error in '/behtop website' Application.

String or binary data would be truncated. The statement has been terminated.An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details:  System. Data. SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated. Source Error: 

Line 312:
Line 313:
Line 314: int result = Convert.ToInt32(_cmd.ExecuteScalar()); Line 315: _cn.Close();
Line 316: //LBLERROR.Text = _cmd.Parameters["@Success"].Value.ToString();

I think its depend to RequiredFieldValidator but I want if users select other Item from DDltrade they select Item from DDLcalssO. Server Error in '/behtop website' Application.

String or binary data would be truncated.The statement has been terminated. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: String or binary data would be truncated. The statement has been terminated. Source Error: 

Line 312:
Line 313:
Line 314: int result = Convert.ToInt32(_cmd.ExecuteScalar()); Line 315: _cn.Close();
Line 316: //LBLERROR.Text = _cmd.Parameters["@Success"].Value.ToString();

View 1 Replies

Data Controls :: Reset All DropDownLists In GridView When DropDownList Of First Row Changed

Mar 9, 2013

<asp:DropDownList ID="ddlday" Width="100px" runat="server" CssClass="iselect" Autopostback="True"
AppendDataBoundItems ="true">
<asp:ListItem Text="--Select--" Value="0" />
<asp:ListItem Text="Full" Value="1" Selected="True" />
<asp:ListItem Text="Half" Value="2" />
</asp:DropDownList>

I have a dropdown in gridview. I bind the gridview after not ispostback condition. Now if i select drodown lsit value "Full" from the first row of gridview i need all other rows of dropdown in gridview to be selected "full" programtically and after that if the user wants to change other row dropdown to "half" then he can change it.

View 1 Replies







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