?
Solved

ASP.NET GRIDVIEW - ADDING COMBO BOX

Posted on 2009-07-02
6
Medium Priority
?
2,128 Views
Last Modified: 2013-11-25
How can I add a combo box column to an asp.net gridview control using vb.net?  I have the code that adds a column that's bound but how do I make it combo boxes?


Try '...add column
            grdOSS0.AutoGenerateColumns = False
            Dim Field As New BoundField
            Field.DataField = "part"
            Field.HeaderText = "Part"
            Dim Col As DataControlField = Field
            grdOSS0.Columns.Add(Col)
            grdOSS0.DataBind()
        Catch ex As Exception
 
        End Try

Open in new window

0
Comment
Question by:jseg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24767468

<asp:TemplateField SortExpression="State" HeaderText="State" >
         <EditItemTemplate>
            <asp:DropDownList DataTextField="State" DataValueField="State" ID="DropDownList2" Runat="server" SelectedValue='<%# Bind("State") %>' >
               <asp:ListItem>CA</asp:ListItem>
               <asp:ListItem>VT</asp:ListItem>
               <asp:ListItem>UT</asp:ListItem>
               <asp:ListItem>MD</asp:ListItem>
            </asp:DropDownList>
         </EditItemTemplate>
         <ItemTemplate >
            <asp:Label Runat="server" Text='<%# Bind("State") %>' ID="Label1"></asp:Label>
         </ItemTemplate>
</asp:TemplateField>

Open in new window

0
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24767484
0
 
LVL 9

Accepted Solution

by:
AsishRaj earned 2000 total points
ID: 24781331
Hi jseg

did you manage to get it working. let us know if you need additional help with it


AR
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Closing Comment

by:jseg
ID: 31599362
Yes, thanks for the help!
0
 

Author Comment

by:jseg
ID: 24788765
I selected to code it programmatically, thanks!
0
 
LVL 9

Expert Comment

by:AsishRaj
ID: 24788865
Glad that i was able to help you.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question