Home
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
VB.NET
VB.NET General Discussion
DropDownList and DataGrid HELP!!!!!!!!!!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="mumick" data-source="post: 7458" data-attributes="member: 2818"><p>Hi vb.net pros,</p><p>I got a big problem with my dropdownlist control, it keeps bothering me more, more. I have a web form with datagrid on it. That datagrid contains multiple columns, one of them has dropdownlist control in it. How do I populate that dropdownlist control for each record in my datagrid.</p><p></p><p>ProductID is my unique field, ServiceLevel has multiple values for each ProductID (ELITE, SELECT, NEXT DAY, MLC). So what I need to do is to populate dropdownlist for each ProductID.</p><p></p><p>ProductID | ListPrice | ContractPrice | ServiceLevel | TotalSellPrice</p><p>1312-231 | $100.00| $20.00 | ELITE,SELECT, | $90.00</p><p>NEXT DAY</p><p></p><p>Here is the code behind I use to populate dropdownlist for one ProductID</p><p>[CODE] </p><p>Public Function BindServiceLevel() As SqlDataReader </p><p>Dim Conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("Connection"))</p><p>Dim cmdSelectDDL As SqlCommand = New SqlCommand("SELECT ServiceLevel FROM ServicePlan WHERE ProductID='44SB150-0000' ", Conn)</p><p>Conn.Open()</p><p>Return cmdSelectDDL.ExecuteReader(CommandBehavior.CloseConnection)</p><p>End Function</p><p>[/CODE]</p><p></p><p>Here is my HTML:</p><p></p><p>[HTML]<asp:TemplateColumn HeaderText="Service Level"></p><p><ItemTemplate></p><p><asp:DropDownList id="ddlServiceLevel" DataSource='<%# BindServiceLevel()%>' DataTextField="ServiceLevel" DataValueField="ServiceLevel" runat="server" AutoPostBack="False"></asp:DropDownList></p><p></ItemTemplate></p><p></asp:TemplateColumn>[/HTML]</p><p></p><p>Please help, thanks in advance.</p></blockquote><p></p>
[QUOTE="mumick, post: 7458, member: 2818"] Hi vb.net pros, I got a big problem with my dropdownlist control, it keeps bothering me more, more. I have a web form with datagrid on it. That datagrid contains multiple columns, one of them has dropdownlist control in it. How do I populate that dropdownlist control for each record in my datagrid. ProductID is my unique field, ServiceLevel has multiple values for each ProductID (ELITE, SELECT, NEXT DAY, MLC). So what I need to do is to populate dropdownlist for each ProductID. ProductID | ListPrice | ContractPrice | ServiceLevel | TotalSellPrice 1312-231 | $100.00| $20.00 | ELITE,SELECT, | $90.00 NEXT DAY Here is the code behind I use to populate dropdownlist for one ProductID [CODE] Public Function BindServiceLevel() As SqlDataReader Dim Conn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("Connection")) Dim cmdSelectDDL As SqlCommand = New SqlCommand("SELECT ServiceLevel FROM ServicePlan WHERE ProductID='44SB150-0000' ", Conn) Conn.Open() Return cmdSelectDDL.ExecuteReader(CommandBehavior.CloseConnection) End Function [/CODE] Here is my HTML: [HTML]<asp:TemplateColumn HeaderText="Service Level"> <ItemTemplate> <asp:DropDownList id="ddlServiceLevel" DataSource='<%# BindServiceLevel()%>' DataTextField="ServiceLevel" DataValueField="ServiceLevel" runat="server" AutoPostBack="False"></asp:DropDownList> </ItemTemplate> </asp:TemplateColumn>[/HTML] Please help, thanks in advance. [/QUOTE]
Insert quotes…
Verification
Post reply
Home
Forums
VB.NET
VB.NET General Discussion
DropDownList and DataGrid HELP!!!!!!!!!!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom