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

May 10th, 2004, 03:02 PM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
getting row no
So me again :)
In ASP.NET, how can i get a row number of the record from the table.
|

May 10th, 2004, 03:05 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,101
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
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
|

May 10th, 2004, 03:07 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
What are you using to display the records?
If you are using a Datagrid you can use datagrid1.datakeys
|

May 10th, 2004, 03:10 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
This is after setting <asp:DataGrid id="datagrid1" runat="server" AutoGenerateColumns="False" DataKeyField="id" ...>
*"id" is the column name from the table.
|

May 12th, 2004, 02:20 AM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 ?
|

May 12th, 2004, 08:20 AM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
That also depends on how you are sorting it. Are you using a database, hash table, or anything else?
|

May 12th, 2004, 09:39 AM
|
Registered User
|
|
Join Date: May 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

May 13th, 2004, 07:36 AM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

May 13th, 2004, 07:45 AM
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |