473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

why does gridview row databound run twice in each row

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
0 1940

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

Similar topics

1
by: Jean-Francois Larvoire | last post by:
Hi, I wrote code to highlight cells in an HTML table when the mouse flies over them. The code works well, except for a strange problem: When the mouse enters a cell, I get 3 events for the...
2
by: DDE | last post by:
Hi, I have defined he following class: public class ContactInfo { public string con_nom; public string con_prenom; public string con_fonction; public string con_email; }
1
by: bminder | last post by:
In the asp.net pages below, Common.vb has an overridable Page_Load sub. In the consuming page, Two.aspx, the Page_Load sub is inherited, but for some reason it (Overrides Sub Page_Load) executes...
5
by: Rashad Rivera | last post by:
I need to know why the Application_Start function fires twice when it initializes. It is doing double work and messing up my process. Thanks for your help - Rashad
1
by: benoit | last post by:
Hi, after binding a SqlDataSource to a GridView, I see 6 records (which is what I want to have !) But if I request a GridView.Rows.Count in the DataBoundEvent, the result is 5. And I cannot...
9
by: J055 | last post by:
Hi I have a very simple configuration of the GridView with paging and sorting. When I do a postback the DataBinding event fires twice - in both the ProcessPostData and PreRender stages of the...
3
by: Mark Leistner | last post by:
I am having problems getting a gridview to bind to custom objects under any non-full trust level. I created a test project to verify what I am seeing isn't a side effect of other code in my...
3
by: Ronald S. Cook | last post by:
I was told that if calling lots of records from the database (let's say 100,000), that the GridView's paging feature would automatically "handle" everything. But the 100,000 records are still...
1
by: =?iso-8859-1?B?R2VhcvNpZA==?= | last post by:
Strange problem... Have a gridview on a page (within an update panel) for displaying event dates. GridView loads fine first time around with the PageLoad. There are 2 text fields a user can...
2
by: Mark B | last post by:
My gridview update command seems to always execute the first part of the SQL statement regardless of whether or not there is a value for the @AutoNumberID parameter. Any ideas? UpdateCommand="...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.