473,655 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

bounding for dropdown list in datagrid

Hello,

I put a dropdown list in ItemTemplate Column. I can select its value from
the dropdown list and store in a dataset, but when I retrieve records from
dataset, it doesn't show up in the datagrid. Is there anything I missed? and
where can I find something for reference?

Thanks.

Here is html code snippets.
<asp:datagrid id="dgProduct" style="Z-INDEX: 102; LEFT: 5px; POSITION:
absolute; TOP: 301px" runat="server" AutoGenerateCol umns="False"
DataKeyField="P roductId" Width="100%">
<Columns>
<asp:BoundColum n DataField="Name " HeaderText="Pro duct Name">
<ItemStyle Font-Size="X-Small"></ItemStyle>
</asp:BoundColumn >
<asp:TemplateCo lumn HeaderText="Pro duct Code">
<ItemTemplate >
<asp:DropDownLi st id="ddlCode" runat="server">
<asp:ListItem ></asp:ListItem>
<asp:ListItem Value="A">A</asp:ListItem>
<asp:ListItem Value="B">B</asp:ListItem>
<asp:ListItem Value="C">C</asp:ListItem>
</asp:DropDownLis t>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:datagrid>


Nov 17 '05 #1
2 6921
Try this link and download gridtest.zip from my site for drop down sample
inside the grid...
Maybe it helps !
http://v4cnet.europe.webmatrixhosting.net/

Rgds
Sukesh
Brain Behind - www.v4cnet.com
"Michelle" <Mi******@yahoo .com> wrote in message
news:ub******** ******@tk2msftn gp13.phx.gbl...
Hello,

I put a dropdown list in ItemTemplate Column. I can select its value from
the dropdown list and store in a dataset, but when I retrieve records from
dataset, it doesn't show up in the datagrid. Is there anything I missed? and where can I find something for reference?

Thanks.

Here is html code snippets.
<asp:datagrid id="dgProduct" style="Z-INDEX: 102; LEFT: 5px; POSITION:
absolute; TOP: 301px" runat="server" AutoGenerateCol umns="False"
DataKeyField="P roductId" Width="100%">
<Columns>
<asp:BoundColum n DataField="Name " HeaderText="Pro duct Name">
<ItemStyle Font-Size="X-Small"></ItemStyle>
</asp:BoundColumn >
<asp:TemplateCo lumn HeaderText="Pro duct Code">
<ItemTemplate >
<asp:DropDownLi st id="ddlCode" runat="server">
<asp:ListItem ></asp:ListItem>
<asp:ListItem Value="A">A</asp:ListItem>
<asp:ListItem Value="B">B</asp:ListItem>
<asp:ListItem Value="C">C</asp:ListItem>
</asp:DropDownLis t>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:datagrid>



Nov 17 '05 #2
Try this link and download gridtest.zip from my site for drop down sample
inside the grid...
Maybe it helps !
http://v4cnet.europe.webmatrixhosting.net/

Rgds
Sukesh
Brain Behind - www.v4cnet.com
"Michelle" <Mi******@yahoo .com> wrote in message
news:ub******** ******@tk2msftn gp13.phx.gbl...
Hello,

I put a dropdown list in ItemTemplate Column. I can select its value from
the dropdown list and store in a dataset, but when I retrieve records from
dataset, it doesn't show up in the datagrid. Is there anything I missed? and where can I find something for reference?

Thanks.

Here is html code snippets.
<asp:datagrid id="dgProduct" style="Z-INDEX: 102; LEFT: 5px; POSITION:
absolute; TOP: 301px" runat="server" AutoGenerateCol umns="False"
DataKeyField="P roductId" Width="100%">
<Columns>
<asp:BoundColum n DataField="Name " HeaderText="Pro duct Name">
<ItemStyle Font-Size="X-Small"></ItemStyle>
</asp:BoundColumn >
<asp:TemplateCo lumn HeaderText="Pro duct Code">
<ItemTemplate >
<asp:DropDownLi st id="ddlCode" runat="server">
<asp:ListItem ></asp:ListItem>
<asp:ListItem Value="A">A</asp:ListItem>
<asp:ListItem Value="B">B</asp:ListItem>
<asp:ListItem Value="C">C</asp:ListItem>
</asp:DropDownLis t>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:datagrid>



Nov 17 '05 #3

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

Similar topics

0
1619
by: Philip Townsend | last post by:
I have a datagrid that contains a dropdown list that is part of an EditItemTemplate. I need to run some code when the dropdown list builds in order to preselect an item in the list. Preselecting the item is not the problem. The problem is that the dropdown object is not instantiated at the point at which the Edit button is clicked, or at any other obvious step in the process. In other words, when a user clicks the Edit (EditCommand)...
3
7306
by: Big Dave | last post by:
I know it's been asked a million times before, but I still can't seem to find an answer that works. I've got a dropdown list in the footer template of a datagrid. The dropdown list databinds, but I can't seem to add a blank item to the top of the dropdown list. I've tried using the code to add this by placing it in both the page_load and the datagrid.itemDataBound event, but neither seems to work. I've also referenced the control by
1
1962
by: Vijay Kerji | last post by:
Hi, I have a datagrid with dropdown list and Remove hyperlink in it as columns. When I remove a row from the datagrid, Dropdown list selection is retaining its previous value. i.e, removed Dropdown item selection is applied to the next dropdown list. Is there any way to fix this problem?
6
5393
by: Jenna Alten | last post by:
I have a datagrid with a template column that contains a dropdown list. I currently fill and display the dropdown list on the page load. This is working correctly. I am NOT using an Edit Column. I am receiving errors when trying to set the selected value of the dropdown within the ItemDataBound() subroutine. Below is the code I am using. I hope someone can tell me if this is possible. '''HTML''' <asp:datagrid id="dgAssignments"...
2
1214
by: Waran | last post by:
I Want to add a dropdown box in a datagrid on Page_Load. This Datagrid shares two tables. One table contains Employee details, and the other having the list of projects the employee is working. Table 1 ------- Name DOB Address
2
2846
by: Peter | last post by:
ASP.NET 2003 In the DataGrid how do I select current cell value in the dropdown box when I click on the edit link, currently when I click on the edit link in the DataGrid the dropdown box appears in the cell, but allways the first item in the dropdown box is shown not the current cell value? How do I make the current value in the cell automaticaly be selected in the dropdown box.
0
2906
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
6
5847
by: yasodhai | last post by:
Hi, I used a dropdown control which is binded to a datagrid control. I passed the values to the dropdownlist from the database using a function as follows in the aspx itself. <asp:DropDownList ID="FldType_add" Runat="server" DataSource='< %#GetFieldType()%>' DataValueField="Type" DataTextField="Type" /> Oce the page is loaded all the values are added to the dropdown list. But when I thought of getting the selected value from the...
4
1443
by: youvrajasnsm | last post by:
Hi All, >I am using datagrid control in asp.net with C#. >I have two dropdown list in datagrid e.g. one dropdown have Classname and another have Studentname. >now I want to show all the studentname in second dropdown related to their class selected in first dropdown. >plz help me in above. >Remember i am using both dropdown in a datagrid.......... Thanks.
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6162
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.