- Joined
- Sep 13, 2006
- Messages
- 1
- Reaction score
- 0
Hi All..
i have been posting this in every ASP.NET forum I can find and read through numerous articles but no one has yet offered any help.. Hoping that I could find some help here.. Herez mi question..
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 :
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..
i have been posting this in every ASP.NET forum I can find and read through numerous articles but no one has yet offered any help.. Hoping that I could find some help here.. Herez mi question..
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..