The RowDataBound event is fired when every row in the GridView is DataBound so there's no need to further iterate through all of the rows. Do something more like this:
Protected Sub GridViewC_Definition_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewC_Definition.RowDataBound
Dim gvr As GridViewRow = e.Row
If gvr.RowType = DataControlRowType.DataRow Then
Dim GridViewTemplateC_ValuesDropDownList = CType(gvr.FindControl("DropDownListC_Values"), DropDownList)
GetC_Attributes.SelectParameters("C_ID").DefaultValue = gvr.Cells(0).Text
GridViewTemplateC_ValuesDropDownList.DataBind()
End If
End Sub
Thanks, Ed
Microsoft MVP - ASP.NET
Marked as answer by polynaux on Jan 31, 2008 05:27 PM
ecbruck
All-Star
98783 Points
9691 Posts
Moderator
Re: Incorrect method signature: ObjectDataSource funktionality for the GridView.RowCreated event
Jan 31, 2008 12:22 PM|LINK
The RowDataBound event is fired when every row in the GridView is DataBound so there's no need to further iterate through all of the rows. Do something more like this:
Protected Sub GridViewC_Definition_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewC_Definition.RowDataBound Dim gvr As GridViewRow = e.Row If gvr.RowType = DataControlRowType.DataRow Then Dim GridViewTemplateC_ValuesDropDownList = CType(gvr.FindControl("DropDownListC_Values"), DropDownList) GetC_Attributes.SelectParameters("C_ID").DefaultValue = gvr.Cells(0).Text GridViewTemplateC_ValuesDropDownList.DataBind() End If End SubMicrosoft MVP - ASP.NET