troubleshooting Question

working rowdatabound gridview footer when there is nothing to bind to a grid view

Avatar of scm0sml
scm0sml asked on
.NET ProgrammingASP.NETVisual Basic.NET
1 Comment1 Solution759 ViewsLast Modified:
I have the code below which occurs on binding to the gridview:
The problem is i need my scripts to be added to the textboxes etc in the footer but it doesnt seem to be hitting this code if there is no data to bind to the grid if no results have been brought back etc.

how can i get around this?

Private Sub gvDeposits_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvDeposits.RowDataBound
        Select Case e.Row.RowType            
            Case DataControlRowType.DataRow
                Select Case e.Row.RowState
                    Case DataControlRowState.Normal
                        CType(e.Row.FindControl("lblDepAmountType"), Label).Text = CType(e.Row.DataItem, DateBandedPaymentTerm).AmountTypeDescription
                    Case DataControlRowState.Alternate
                        CType(e.Row.FindControl("lblDepAmountType"), Label).Text = CType(e.Row.DataItem, DateBandedPaymentTerm).AmountTypeDescription
                    Case DataControlRowState.Edit
                        AddVBScript(CType(e.Row.FindControl("txtOldDepStartDate"), TextBox), "onChange", "TextChanged(Me)")
                        AddVBScript(CType(e.Row.FindControl("txtOldDepEndDate"), TextBox), "onChange", "TextChanged(Me)")
                End Select
            Case DataControlRowType.Footer
                AddVBScript(CType(e.Row.FindControl("txtNewDepStartDate"), TextBox), "onChange", "TextChanged(Me)")
                AddVBScript(CType(e.Row.FindControl("txtNewDepEndDate"), TextBox), "onChange", "TextChanged(Me)")
        End Select
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros