Web Forms :: Creating Drop Down List From DataGrid
Apr 8, 2010
is there a way of creating a drop down list from the datagrid code below i.e. draw the data from ID="dgvfitters" to create a drop down, which is generated from the database? What would I need to do with the code and how would I implement it? The code is as follows:
<asp:DataGrid runat="server" ID="dgvFitters" AutoGenerateColumns="False" CssClass="defaultTable"
Font-Bold="False" ForeColor="Blue" OnItemDataBound="dgvFitters_ItemDataBound" BorderStyle="None" BorderWidth="0px" CellPadding="10" GridLines="None">
<AlternatingItemStyle BackColor="#CCDBEE" BorderStyle="None" BorderWidth="10px" />
<ItemStyle BackColor="#eeeeee" BorderStyle="None" BorderWidth="10px" />
<Columns>
<asp:BoundColumn DataField="ShortName" HeaderText="Dealer">
<ItemStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" ForeColor="#0054a4" Font-Names="arial" Font-Size="12px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="FullAddress" HeaderText="Address">
<ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" ForeColor="#0054a4" />
</asp:BoundColumn>
<asp:BoundColumn DataField="DistanceSquared" HeaderText="Distance (miles)"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton ID="btnSelect" CommandName="select" runat="server" ImageUrl="~/graphics/step3_button.png" ToolTip="Go to 'Step 3 - Choose your tyres'"
OnCommand="btnSelect_Command" OnClientClick="jsEnabled();" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle ForeColor="#ef3e42" BackColor="#ffffff" CssClass="resultsHeader" Height="10px"/>
</asp:DataGrid>
View 3 Replies
Similar Messages:
Apr 8, 2010
How would I re-code the datagrid below so it displays as a drop down list? The data I want to display in the drop down list is ID="dgvFitters".Also, is it possible to display the data in a datagrid and in a drop down list simultaneously?
<asp:DataGrid runat="server" ID="dgvFitters" AutoGenerateColumns="False" CssClass="defaultTable"
Font-Bold="False" ForeColor="Blue" OnItemDataBound="dgvFitters_ItemDataBound" BorderStyle="None" BorderWidth="0px" CellPadding="10" GridLines="None">
<AlternatingItemStyle BackColor="#CCDBEE" BorderStyle="None" BorderWidth="10px" />
<ItemStyle BackColor="#eeeeee" BorderStyle="None" BorderWidth="10px" />
<Columns>
<asp:BoundColumn DataField="ShortName" HeaderText="Dealer">
<ItemStyle Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" ForeColor="#0054a4" Font-Names="arial" Font-Size="12px" />
</asp:BoundColumn>
<asp:BoundColumn DataField="FullAddress" HeaderText="Address">
<ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False"
Font-Underline="False" ForeColor="#0054a4" />
</asp:BoundColumn>
<asp:BoundColumn DataField="DistanceSquared" HeaderText="Distance (miles)"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:ImageButton ID="btnSelect" CommandName="select" runat="server" ImageUrl="~/graphics/step3_button.png" ToolTip="Go to 'Step 3 - Choose your tyres'"
OnCommand="btnSelect_Command" OnClientClick="jsEnabled();" />
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<HeaderStyle ForeColor="#ef3e42" BackColor="#ffffff" CssClass="resultsHeader" Height="10px"/>
</asp:DataGrid>
View 4 Replies
Mar 17, 2011
This is my first post as a newbie to asp.net.
I am in the process of creating a "news system", you can add, edit and delete news. The news items can be entered into the SQL database and you select a category where you want the news item to go into.
What I want is when someone comes to the "Edit" screen, they have a drop down list and what that does is allows you to select a category for you to edit news items from, so rather than at present having the "Edit" page display all the news items, I want people to be able to choose a category that they can edit news items in.
So far my edit page has a datagrid with the following code:
[code]....
View 4 Replies
Mar 22, 2010
how do i create a cascading drop-down list without using ajax controls...i am using queries and the language i am using is C# I have a client and a project database....when i choose a client name in the dropdownlist....only the project names associated with that client should appear in the next dropdownlist
View 3 Replies
Mar 30, 2010
I have a drop down list that has the initials of about 12 of our sales guys.How can I make it so that when they select their initials from the list, the next drop down list only shows their customers.In my database there is a column for customer name and salesman.
View 6 Replies
Mar 12, 2010
How can I have 2 Cascading Drop Down Lists for the same Drop Down List?here is my problemi have 3 drop down lists read from database1- Schools List 2- Classes List3- Teachers ListEvery School will have more than 1 Class and more than 1 TeacherWhat I want is when user select a School from Schools Drop Down List then BOTH (Classes and Teachers) should be refreshed based on the School Drop Down List
View 1 Replies
Jun 24, 2010
I have drop down list box that I would like to show two columns, is this possible? Or can it be done with a list box?The query correctly retrieves all of the table data to be displayed, one colum is an abbreviation, the other a bit longer description.
View 2 Replies
Feb 6, 2010
I have the following Students class:
[Code]....
I need the 1 since it's a foreign key in another table. For the life of me, I can't get this to work like this.
View 7 Replies
Jan 8, 2010
I had called the data from query to data table and now i have a gridview in which i am using one datalist and 2 text boxes and and reming coloumns are bounded iahve to assiaign them values which datatable have either null or any value.
View 2 Replies
Sep 2, 2010
All my current functionalities are in .net datagrid. I have to include a new feature like drag and drop any row inside the datagrid to change the order of the row.
But, it should happen in client, during save the new order should save in the database.
Any plugins or scripts available to acheive this?
View 3 Replies
Nov 3, 2010
I have a Datatable which is binded to a Datagrid of the following format
[Code]....
I would like to have images in place of values.That is if 1 is present i would like to have 1.jpg, if 2 is present 2.jpg and so on.
Is there any possibility of doing this in OnItemDataBound event checking each item values.
View 4 Replies
Nov 10, 2010
I have a requirement in my application that, while saving the application, need to get all the value from drop down list and pass it to the view model. But application should not allow the user to select more than one item from drop down list manually, ie, only one value at a time. My view model is like ...
public class ListManagement
{
public IEnumerable<selectListItem> InactiveProduct { get; set; }
public string[] InactiveProductSelected { get; set; }
public IEnumerable<selectListItem> ActiveProduct { get; set; }
}
[code]...
View 3 Replies
Apr 9, 2010
I want to display the datagrid code below as a drop down (like the example below). I've read through so many forums but can't get anywhere.
[code]...
View 1 Replies
Jul 8, 2010
What I am looking to do is have a page with 2 seperate datagrids on, I want to be able to add the selected rows from DataGrid1 into DataGrid 2 either with a button click or using drag and drop functionality (Im guessing this would require javascript and I have no experience with this language, is it difficult to learn or could I just alter code from elsewhere?). Once the row is added into DataGrid2 I would like to be able to add some information, such as Quantity and DateDue (could this be added in a pop up box when the part is added?) Also I would like fields in DataGrid1 to be based upon a search with several different options that the user specifies, i.e the ability to search based on project number, however it would return eitheer parts or assemblies depending on a check box selected. I have very limited programming knowledge but Im guessing I would be able produce a query based on the inputs, but in order for this to work wouldnt the page to postback everytime an option was changed.
View 1 Replies
Mar 25, 2011
I am getting this error yet I know it to be untrue.This is the code:
ddlPartnerOrganisation.DataSource = agency.AgencyGetListOfEYDN();
string temp = ddlPartnerOrganisation.SelectedValue.ToString();
ddlPartnerOrganisation.DataValueField = "AgencyID"
;
ddlPartnerOrganisation.DataTextField = "AgencyName"
;
ddlPartnerOrganisation.DataBind();
View 4 Replies
Aug 31, 2010
I have two drop down list on a page. The first one list projects and the second list users. The userlist is populated with an object datasourse that pulls a list of users for the selected Project.Whenever the Project list selection changes the second ddl Userlist always reverts to the first person in the list instead the person that was selected before a new Project was chosen.
View 1 Replies
Jan 7, 2011
I am trying to create an MVC List View that can be filtered by the value selected from a drop down list.
Selecting a value should repost the page ... Since there is no concept of view state data I am having some issues with this ... I can get the repost to take place but my drop down resets and I am not able to get the value that was selected.
ASSET CONTROLLER:
[Code]....
[Code]....
I have tried many of the posts that refer to setting up drop down lists but can't set them up in the content because this is a List View.
View 8 Replies
Mar 3, 2010
I have a Drop Down List which I need to bind to the database. Here is the situation. I am not using a SQLDataSource. It is built on the n-tier application. The datasource of the dropdown is referring to a method in the C#class. That method has a generic array list which populates information into the arraylist. The Arraylist is the parameter that is returned to the DropDown List.
I have also set the Text property of the Drop down list
Text='<%DataBinder.Eval(Container.DataItem,"Employee_ID")%>'>
However, it is not populating the DropDown list, what should I do?
View 14 Replies
Jul 15, 2010
I retrieved values from database to drop down ,how can i make them as sortable.
View 5 Replies
Sep 20, 2010
I want to make a button that changes the value in a dropdown list (dropdown populated from SQLdatasource)This sounds strange i know but i have 4 dropdowns each hidden by panels, unless the preceeding dropdown's value is changed from it's initial value. So i make a selection from my first dropdown list & a postback occurrs triggering the next panel (and as such
the dropdown list) to become visible, this occurs again until eventually my users will see 4 drop down boxes...(all required field vals etc)
View 6 Replies
Aug 17, 2010
I am trying to write a web page where i have to select an item form a drop down list.
I am using linq to sql to get the data from the database.the strange thing is that i can register the data to the drop down list but when i select one of them the drop down list lets me to the first item. I set post back = true because i want to update the page every time an item get selected. I wrote a really simple code to check what was going wrong but still...no success. Below i am bringing the code i wrote.
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication7.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
[Code]....
View 8 Replies
Jun 22, 2010
I have combined my SQL result to display in drop down list in such manner:
" SAV 123-423-231 "
" CUR 234-234-212"
User selects which account to view. So if the user selects SAV 123-423-231, I have to pass in the bank account number. How do I do that?
By split? I tried doing this:
ddlAcc.text.split(" ")
View 10 Replies
Mar 9, 2010
Iam working on a web based form where I have a DDL to which I have attached a field validator which is not working. It should function in such a way that whenever the DDL is left to blank, it gives user an error. I have introduced that BLANK in the DDL using ListItem as I found that as the easisest way out.
<asp:DropDownList ID="DropDownList4" runat="server"
DataSourceID="AccessDataSource4" DataTextField="myState"
DataValueField="myState" AppendDataBoundItems="true">
<asp:ListItem Selected = "True" Text = "" Value = ""></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="reqState" runat="server"
ErrorMessage="RequiredFieldValidator" Text="Required Field"
InitialValue="None" ControlToValidate="DropDownList4" Display="Dynamic">
</asp:RequiredFieldValidator>
View 1 Replies
May 5, 2010
How can I make the first item in a drop down list non selectable. I want this first list-item to show up when the page is opened and want to populate the rest of the DDL from a backend DB. I don't want this default first item in the list to be selected (just want to show it as a default value)
I want it to look something like this.
Choose a State: (Appearing on the top of DDL, but cant be selected)
TX
IL
NY
FL
View 7 Replies
Aug 4, 2010
i am using SQL table to cascading 3 drop down list. this is search fields for cars by manifacture, model and year. the 2 first ddl has autopostback and AppendDataBoundItems (true) i want the user will select the facture first, then the 2th ddl will display the models of that manifacture and then the year. for the first time its working good, but when i change the manifacture for the second time, in the model i have the new values + the old values, and go on and on, if i select diffrent facture the model ddl have now values of 3 diffrent manifacture,
[Code]....
View 2 Replies