Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 9th, 2004, 05:25 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default select value of a dropdown in a datagrid

I have a datagrid with a dropdownbox in it(asp vb net)
I have no problem populating the grid or the dropdown.
My problem is how do i get the value from the selected item of the drop down box?
 
Old December 9th, 2004, 05:53 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The HTML tag:
<asp:DropDownList OnSelectedIndexChanged="update_sites" AutoPostBack="true" id=affiliate_list runat="server" />

The Code:
Public sub update_sites(sender As Object, e As EventArgs)
Dim sql As String = "SELECT site_name, site_id from sites where affiliate_id=" & affiliate_list.SelectedValue
..
..
..
end Sub


 
Old January 14th, 2005, 05:19 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

hazlema, that won't work.

Sbartis,

You'll need to access the DDL from the context of the datagrid item. Off of the item you can find the control, cast it to a DDL then access it's value.

CType(datagriditem.FindControl("myDropDownListID") , DropDownList).SelectValue





Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating dropdown within a datagrid ninel ASP.NET 2.0 Basics 7 May 26th, 2006 03:26 PM
Dropdown list in a datagrid maddy137 ASP.NET 1.0 and 1.1 Professional 0 May 19th, 2006 02:05 PM
Displaying Records From SELECT dropdown mgordon Classic ASP Databases 12 August 3rd, 2005 12:27 PM
DropDown in DataGrid kiranpanjala Classic ASP Databases 0 January 24th, 2005 10:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.