CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 12/12/2006 9:17:03 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 9 Views: 67 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
10 Items, 1 Pages 1 |< << Go >> >|
chris555
Asp.Net User
MasterPage and gridview's RowDataBound occuring twice12/12/2006 9:17:03 PM

0/0

I'm stumped. I'm using a masterpage and my only content area has a grid view ('gridview1'). I'm using the gridview1_rowdatabound to create a summary total field. The issue is that it cycles through this sub twice???? So my total reflects twice the amount. My master page does not have any grid controls, etc. Mostly cosmetic.

Help.

Yani Dzhurov
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/13/2006 7:57:56 AM

0/0

Hi ya,

probably you could paste some code here ? I'm pretty sure that the event is fired only once but you are processing it twice.

 

Cheers,

Yani 


Thanks,


Yani Dzhurov

chris555
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/13/2006 8:22:32 PM

0/0

I've found an article that explains that you can do this in one of two ways.

1.) since I have the values already in the dataview just total them during creation. This is where, when I put my stops in the code, I see it cycling through the sub twice. I have it commented currently. The GridView1_RowDataBound executes twice.

'Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)

' Dim subTotal As Decimal

' Dim rowValue As String

' If e.Row.RowType = DataControlRowType.DataRow Then

' rowValue = Replace(e.Row.Cells(6).Text, "$", "") 'strip out $

' If Decimal.TryParse(rowValue, subTotal) Then

' totalSubTotal += subTotal

' End If

' End If

'End Sub

'Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)

' lblSubTotal.Text = "<h5>Total: " & totalSubTotal.ToString() & "</h5>"

'End Sub

 

The second option is:

2.) to create another select command and use that single value that is the total. Creating another trip to the db. More overhead though. But how would I then put the output value to a label? This is a single value so I ouldn't use dataview, etc.?

SqlDataSource2.SelectCommand =

"Select sum(Cart_ItemPrice*Cart_OrderQty) as orderTotal from tbCart"

<asp:Label ID="lblSubTotal" runat="server" />
Yani Dzhurov
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/13/2006 8:37:36 PM

0/0

I know it is pretty stupid solution for this problem, but for the time being until you find the source for the problem, you could simply devive totalSubTotal by 2:

 'Protected Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)

' lblSubTotal.Text = "<h5>Total: " & (totalSubTotal/2).ToString() & "</h5>" 'End Sub

Or sth like that.

Cheers,

Yani 


Thanks,


Yani Dzhurov

chris555
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/13/2006 11:03:28 PM

0/0

Yea, I thought about that. I also saw an obscure posting that suggested a microsoft defect in VS 2005 for Master Pages and Gridviews?

I've also used below to first get row count then cycle through them using that.

' Dim subTotal As Decimal

' Dim rowValue As String

' If rowCounter < recCount Then

' If e.Row.RowType = DataControlRowType.DataRow Then

' rowValue = Replace(e.Row.Cells(6).Text, "$", "")

' 'subTotal = e.Row.Cells(6).Text

' If Decimal.TryParse(rowValue, subTotal) Then

' totalSubTotal += subTotal

' End If

' rowCounter += 1

' End If

' End If

'End Sub

 On top of all this, I also have pagination, and I've found that I would get rows.count = whatever was on the page, etc. You'd think that this would be simpilier.

I saw another postings discussing a solution but I wouldn't be able to use callbacks.

Thanx.

chris555
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/15/2006 8:07:47 PM

0/0

Here is what I see happening now, I hope someone can figure out why. I'm using pagination and I have it set to 4 records. There are a total of 7 records. So as I watch the rowdatabound sub I see it go through the 7 rows then start again at the first page which has 4. So my Total ends up being 11 items totals, not the complete 7. The gridview is displaying correctly. I'm using allowcallbacks, but see this when that is turned on. The grid is also in a masterpages content area, but is the only grid.

If I select the pagination button for page 2, the total now shifts to only those 3 records. Then when I return to the first page it now only totals the four????????????? 

defect is 2.0? Thanx.

Yani Dzhurov
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/15/2006 8:38:26 PM

0/0

Hi,

i experienced similar problem recently. While debugging i found out that the additional row weren't data bound ones, but footer and header.

It is quite possible that it is the same for your scenario. You have two pages for these 7 records , so probably there are two headers and two footers ? Or there could be a pager row ?

You could trace and see the type of each row to see what exactly is going on, but i don't think it is a defect/bug in 2.0 :)

Cheers,

Yani 


Thanks,


Yani Dzhurov

chris555
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/15/2006 9:22:44 PM

0/0

I thought that but traced it and found all were what I call "body" rows.

I'm using 'e.Row.RowType = DataControlRowType.DataRow' so I can clearly see non-footer and header data.

Yani Dzhurov
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/15/2006 9:32:49 PM

0/0

hmm, quite strange .

So probably you could trace either some value of these rows, some ids probably? So you could identify which exactly are this fields. I think you mentioned that the repeated rows are the rows on the first page, right ?

My assumption is that you have only 7 rows, but the event DataRowBound is fired twice for some of them, or you have registered twice for this event ?

Cheers,

Yani 


Thanks,


Yani Dzhurov

chris555
Asp.Net User
Re: MasterPage and gridview's RowDataBound occuring twice12/15/2006 9:38:56 PM

0/0

I think the big question is Can pagination be screwing this up? Or maybe in conjuction with another set option. I'm going to try sveral combinations to see if I can narrow it down.
10 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
MasterPage and gridview's RowDataBound occuring twice - ASP.NET Forums MasterPage and gridview's RowDataBound occuring twice .... that suggested a microsoft defect in VS 2005 for Master Pages and Gridviews? ...
MANAGE MULTIPLE MODULES - ng.asp-net-forum.dotnetnuke ... Zone: ... search modules. masterpage and gridview's rowdatabound occuring twice ... Need to display 4 VCL Forms in 4 diferent monitors (one form per ...
TheMSsForum.com >> Asp >> is there a itemdatabound in gridview ... Hello, We use Master Pages in our website and need a page to be created ...... . com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx ...
Essential Studio ASP.NET : Version History : Syncfusion Grid rows drag n drop not working in master pages. RadioButton celltype is throwing exception. Autoformat styles of GridView control, which does not get ...
Passing a variable to a UserControl with GridView and ... RowDataBound If e.Row.RowType = DataControlRowType. .... The problem seems to be occurring after the 2nd time this is run. ...
AJAX Control Toolkit - Issue Tracker The AutoCompleteExtender fails to display all the #'s for an all numeric value such as ...... ModalPopup, MasterPage, User Control, GridView and UpdatePanel ...
Live XML feeds support – RadRotator Template manager – allows you to upload Master Pages and create Templates for ...... Fixed: GridView’s Save/Load layout settings - Save/Load layout excluded ...
microsoft.public.dotnet.framework.aspnet (thread) GridView RowDataBound not called after postback, danc, 2006/02/17 ...... Re: Validation Not Occuring, S. Justin Gengo [MCP], 2006/02/07 ...
September 2008 - .Net Advanced topic Update() method inside the gridviews rowupdated event, it says that the ...... the row during RowDataBound, so you have to check for the appropriate color. ...
September 2008 - .Net Advanced topic Update() method inside the gridviews rowupdated event, it says that the ...... the row during RowDataBound, so you have to check for the appropriate color. ...




Search This Site:










loggin in portals automatically.

how to create a forum using dnn 4.0.2?

re-authenticating a user even with the authentication cookie set

editmodule

can't run .asmx files?

tool to convert mdf to sql?

web page looks great in ie 7 (no supprise) but is meesed up in firefox.

why does menu control not show subnavs unless page refreshed?

skinning question

where can i donwload vs 2005 team system

treemenu, hyperlink & sitemap

database problem i think :)

skin upload - file manager (.zip) vs. ftp (.aspx, etc)

c# equivalent of addressof

restricting users based on roles

3.0.13 issue?? visible by administrators only

can we extend the precompiled & deployed application in asp.net

nagivation issue with gallery add-in for dnn3

grouping members

how to add a user-control to a page?

web designer & asp.net configuration tool error

password expiry

visual studio crashes

what is with the naming conventions of user controls in vs2005!

replacing web.config connectionstring user id and password

forms processing

where can i get download the ibuystore code with accesss and vb?

upgrade issues 2.0.4 to 2.1.2

request is not available in this context

tabstrip && internet explorer 7

 
All Times Are GMT