Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 17th, 2003, 07:40 PM
Registered User
 
Join Date: Jul 2003
Location: , WA, USA.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Find total row count when databinding

This is a hard one to explain, so I'll just go with an example - I'm creating a databound datagrid where one column shows the priority ranking of each row, from 1 to the total number of rows. These will be presented as dropDownLists so that the user can select a new priority for each row.

I've created my own simple user control that creates a dropdownlist with options from 1-TotalRows and then sets the selected index based on the current priority of the item. I have a template column in my datagrid that calls the user control:

<asp:TemplateColumn SortExpression="Priority" HeaderText="Priority">
<ItemTemplate><uc1:myPriority CurrentPriority='<%# DataBinder.Eval(Container.DataItem, "Priority") %>' TotalRows="5" runat="server"></uc1:myPriority>
</ItemTemplate>
</asp:TemplateColumn>

As you can see, I need to pass two parameters into my usercontrol - the CurrentPriority, which I am easily getting from the current row, but also the TotalRows, which I have no idea how to find. DataBinder doesn't seem to have a way to let me find it here. If I do an .ItemCreated event in my codebehind, I'd be able to get the total number of rows, but I can't figure out a way to pass that as a parameter to my user control. I'm just looking for any way to accomplish this goal.

Thanks,
Julie




Similar Threads
Thread Thread Starter Forum Replies Last Post
Total Count of Specific Records in a Report Odeh Naber Access 5 August 1st, 2007 03:50 AM
count the TOTAL number of segments crmpicco Classic ASP Basics 2 February 1st, 2005 05:03 AM
Getting Total Page Count eman2a Crystal Reports 0 August 11th, 2004 10:53 AM
Sub Total, Count discriminating dkaco BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 23rd, 2004 12:04 PM
Total Page Count denis74hd Crystal Reports 4 May 27th, 2004 02:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.