Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
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 February 19th, 2007, 12:25 AM
Registered User
 
Join Date: Feb 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to slaverymorgue Send a message via Yahoo to slaverymorgue
Default manipulating individual rows inside a datagrid..

Hi all..

I need help with a function that I have written for a selectedindexchange event of a drop down list which is embedded inside a datagrid..

The source code i have written is as below :

Code:
Protected Sub toSectDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim row As DataGridItem
            For Each row In SectionGrid.Items
            Dim toSectDDL As DropDownList = CType(sender, DropDownList)
            Dim toSubSectDDL As DropDownList = CType(row.FindControl("toSubSectDDL"), DropDownList)
          Dim toSectID As Integer = CInt(toSectDDL.SelectedValue)
            Utilities.LogError("toSectID " & toSectID)
            toSubSectDDL.DataSource = Office.GetSubSectionsForSection(toSectID)
            toSubSectDDL.DataTextField = "subsection"
            toSubSectDDL.DataValueField = "subSecID"
            toSubSectDDL.DataBind()
            toSubSectDDL.Items.Insert(0, New ListItem("Select", "0"))
             Next
    End Sub


The thing is when i use row.FindControl the toSectDDLs in all the rows of the datagrid are affected whereas i want to manipulate the drop down list only on a single row.. When I try using SectionGrid.FindControl instead of the row.FindControl I get a server error saying "Object reference not set to an instance of an object. "

So anyone has any ideas plz do contribute......:(

Thanks..





Similar Threads
Thread Thread Starter Forum Replies Last Post
get value of textbox inside datagrid khaink ASP.NET 1.0 and 1.1 Basics 9 October 2nd, 2007 10:05 AM
User COntrol Datagrid inside datagrid rodmcleay ASP.NET 1.0 and 1.1 Professional 3 April 14th, 2007 10:11 AM
dropdownlist inside datagrid myunus General .NET 11 October 29th, 2006 07:37 AM
diffculty manipulating datagrid drachx General .NET 0 October 9th, 2005 08:10 PM
dropdownlist inside datagrid shaileshmark General .NET 5 June 27th, 2004 05:18 AM





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