473,397 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

GridView w/ drop down menu

Hi,

I would like to put a drop down menu in a gridview with the datatype
selected from the SQL database.

These are the values will show.
red
orange
white
green

It shows the selected on the drop down list.

Currently, I'm query a SQL statement and put these in gridview using
datasource, datatable & sqladapter to show text.

Any help for drop menu?
Oct 7 '08 #1
3 1848

"Slickuser" wrote:
Hi,

I would like to put a drop down menu in a gridview with the datatype
selected from the SQL database.

These are the values will show.
red
orange
white
green

It shows the selected on the drop down list.

Currently, I'm query a SQL statement and put these in gridview using
datasource, datatable & sqladapter to show text.

Any help for drop menu?
Would you be thinking of a DataGridViewComboBoxColumn?

http://msdn.microsoft.com/en-us/libr...boxcolumn.aspx

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 7 '08 #2
I'm using this for a web base form.

I currently have the data but I am not sure if it can be achieve or
not.

On Oct 6, 10:54*pm, Morten Wennevik [C# MVP]
<MortenWenne...@hotmail.comwrote:
"Slickuser" wrote:
Hi,
I would like to put a drop down menu in a gridview with the datatype
selected from the SQL database.
These are the values will show.
red
orange
white
green
It shows the selected on the drop down list.
Currently, I'm query a SQL statement and put these in gridview using
datasource, datatable & sqladapter to show text.
Any help for drop menu?

Would you be thinking of a DataGridViewComboBoxColumn?

http://msdn.microsoft.com/en-us/libr...forms.datagrid...

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 7 '08 #3
Here's the screen shot:
http://img510.imageshack.us/img510/2629/sn1uj0.jpg

I can show ID & COLOR from SQL database as text.
I just want to put these in a dropdownlist with value from SQL
selected and other have generic one (not possible?)

What I need put in my SQL to have the checkbox auto check or not
check?

Where can I enter my code to do what I want when the Delete button is
press (mostly delete that row & delete from SQL). I named the command
as DeleteMe.

Also, my top drop down menu doesn't show my selected value to a label
when change it.

View source code below.. thanks a lot.

<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="colorDrop" runat="server"
OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged">
<asp:ListItem>orange</asp:ListItem>
<asp:ListItem>red</asp:ListItem>
<asp:ListItem>blue</asp:ListItem>
<asp:ListItem>green</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="testLbl" runat="server"></asp:Label><br />
<br />
<br />
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" />
<asp:BoundField DataField="COLOR" HeaderText="Color" /
>
<asp:CheckBoxField DataField="ENABLE"
HeaderText="Yes" />
<asp:ButtonField ButtonType="Button"
CommandName="DeleteMe" Text="Delete" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>

protected void DropDownList1_SelectedIndexChanged(object sender,
EventArgs e)
{
testLbl.Text = colorDrop.SelectedValue.ToString();
}

Oct 7 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
4
by: simon.cigoj | last post by:
I have an javascript made menu and some forms with the dropdown element. When the menu opens and scrolls down the drop down is displeyed over the menu and obscures the menu choices. I have this...
1
by: Mark Richards | last post by:
I posted this earlier, and got no response. Basically I need to be able to grab a value from one of the fields in a gridView to populate a dropdown in another column of the gridview: I have a...
4
by: bryan | last post by:
Hi all, I am working on a .net 2.0 web app. On page load I display a gridview with a drop down list (Employees), when the user selects from the drop down list, the grid view is filled with...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
0
by: mike0870 | last post by:
Hi, I've been at this one for hours and cannot not find any posts of anyone having the same problem. Ther scenario is, I need to fill a drop down box with a value in the grid row to pass to the...
4
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters...
0
by: seanmatthewwalsh | last post by:
This should be REALLY straightforward. I have a gridview that allows editing, deleting and inserting (from the footer row). There is a Drop Down ListBox in the one column, which needs to ALWAYS set...
5
by: Mark B | last post by:
I'd like to have a field in a gridview (or standalone on a webpage) that not only drops down each salespersons name but also precedes their name with a blue, red, green or orange dot icon depicting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.