Wrox Programmer Forums
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 May 10th, 2004, 03:02 PM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default getting row no

So me again :)
In ASP.NET, how can i get a row number of the record from the table.

 
Old May 10th, 2004, 03:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
Default

There is no "Row number".. there's an identity field you would either need to set or you can use an autonumber which would create an identity for you.

Hal Levy
Web Developer, PDI Inc.

NOT a Wiley/Wrox Employee
 
Old May 10th, 2004, 03:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

What are you using to display the records?

If you are using a Datagrid you can use datagrid1.datakeys

 
Old May 10th, 2004, 03:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

This is after setting <asp:DataGrid id="datagrid1" runat="server" AutoGenerateColumns="False" DataKeyField="id" ...>

*"id" is the column name from the table.

 
Old May 12th, 2004, 02:20 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default

I think that my question was not precise. What exectly I need is the position of a perticular record in a perticular table of a DataSet.

For example if the records in the table are:

id Name
1 John
2 Maria
3 Glen
6 Smith
8 Bush
13 Cathy
14 Nina

Now what exectly I need is the exect location of a name in the records. For example if I search for "Bush" then in return I need anumber indicating its location i.e. 5

Is it possible ?

 
Old May 12th, 2004, 08:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

That also depends on how you are sorting it. Are you using a database, hash table, or anything else?

 
Old May 12th, 2004, 09:39 AM
Registered User
 
Join Date: May 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are using a DataGrid or a Repeater to display the records, then you can use DataGridItem.ItemIndex or RepeaterItem.ItemIndex to get the row number.

Manish Jadhav


 
Old May 13th, 2004, 07:36 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default

I am using the DataSet in a class and to sort the data I am just usin the ORDER BY clause of the query that is used to create the DataSet.

I need to use it in some ASP.NET pages.

 
Old May 13th, 2004, 07:45 AM
Authorized User
 
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to creative_eye
Default

I basically need to create a utility method that has a signature like this:

  Public Function GetRowPosition(ByVal TableName As String, ByVal ColumnName As String, ByVal SearchKey As String) As Integer

I will use this method like this:

Dim Position As Integer = GetRowPosition("Table1", "Column1", "Bush")

and the value in the variable Position should be 5 according to the records in the table.

I am not using any GUIs and it must be in a plain simple class.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrollbar in row of Datagrid Except Header Row Theone84 ASP.NET 2.0 Professional 0 August 11th, 2008 12:10 AM
To retrieve a row by giving row number prad_a MySQL 1 March 22nd, 2007 11:20 PM
Read a column and Search Row by Row in another col AyatKh Excel VBA 2 January 26th, 2005 12:02 PM
Row blinking or Row Red mateenmohd Classic ASP Basics 4 January 26th, 2005 05:40 AM
Manage data row by row in datagrid Dragonist Classic ASP Databases 5 July 29th, 2004 04:17 AM





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