Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics 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 July 5th, 2006, 06:10 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default AlternatingItem on a datagrid

HI everyone!
Please help me, i have a datagrid with a list of columns, one column is a dropdown list which i want to populate it depending on the value of column 1(typeID)

This is waht i currently have for the dropdown

<asp:TemplateColumn HeaderText="Fruits">
<ItemTemplate>
<aspropDownList id="Fruits" runat="server"></aspropDownList>
</ItemTemplate>
</asp:TemplateColumn>

And on my code behind on ItemDtaBound i have

       Dim ID As Integer
        Dim iType As Integer
        Dim oDR As DataRow
        Dim oDRs() As DataRow
        Dim oDDL As System.Web.UI.WebControls.DropDownList
 If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem) Then

                ID = CInt(e.Item.Cells(0).Text)
                oDRs = MY_ClientDataSet.Tables(0).Select("FRID = " & ID)
                oDR = oDRs(0)
                iType = CInt(oDR("TypeID"))
                oDDL = CType(e.Item.FindControl("Fruits"), System.Web.UI.WebControls.DropDownList)

                Case 1
                    Fruits.Items.Add(New ListItem("apple", "1"))
                    Fruits.Items.Add(New ListItem("pear", "2"))
                Case 2
                    Fruits.Items.Add(New ListItem("avo", "1"))
                    Fruits.Items.Add(New ListItem("tomato", "2"))
                    Fruits.Items.Add(New ListItem("lettuce", "3"))
                End If
End if

When i debug, i dont even get inside the IF statement, it jumps it.resulting in my dropdowm being always empty






Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
Datagrid k.manisha ASP.NET 1.0 and 1.1 Professional 2 May 20th, 2008 07:18 PM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
Creating DataGrid In Repeater/DataGrid liduwan ASP.NET 1.0 and 1.1 Professional 9 March 6th, 2007 03:31 PM
datagrid ajaidass ADO.NET 2 March 1st, 2007 05:36 PM





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