By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

why does gridview row databound run twice in each row

P: 19
I created a new project, threw a grid on it along. i was wrote the function of formatphone in each gridview rows, i used to below code:


Protected Sub grdpatient_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles grdpatient.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
Dim dbPat As DBUser = New DBUser(Page)
Dim sFormattedPhone As String = ""
Dim Phone1 As Label = CType(e.Row.FindControl("lblhome"), Label)
Dim Phone2 As Label = CType(e.Row.FindControl("lblwork"), Label)

If Phone1.Text = "Null" Then
Else
Phone1.Text = DBUser.FormatPhone(Phone1.Text)

End If
If Phone2.Text = "Null" Then
Else
Phone2.Text = DBUser.FormatPhone(Phone2.Text)
End If
dbPat = Nothing
End If
End Sub


why this event call twice in each rows.. please help me..

Thnaks in advance
Nov 4 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.