Get row index of found row

How do I find the row index after searching a Dataset Table? For example,

<code>
Dim recId As String = Request.QueryString("r")
Dim r As DataRow
Dim tbl As DataTable = ds.Tables("drivers")
tbl.PrimaryKey = New DataColumn() {tbl.Columns("recId")}
If NOT IsNothing(tbl.Rows.Find(recId)) Then
               r = tbl.Rows.Find(recId)
End If
</code>

Next, I want to know the row index of the row, r, so the user can move foward and back, from this point, through the rows in the table, in order to display the next record in the table or the previous record in the table.

http://www.pageforwarddesign.com
0
digitaldi
3/28/2005 4:58:00 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1204 Views

Similar Articles

[PageSpeed] 26

I see find as the only mechanism that searches for you; otherwise, loop through each row.

Brian


Brian

"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4).
0
bmains
3/28/2005 5:15:23 PM
I must not have made my question clear. Once found, a datatable row corresponds
to a row index in the datatable, such as tbl.row(10) where 10 is the row index. I want to know the
index, into the datatable, of the row that has just been found.

http://www.pageforwarddesign.com
0
digitaldi
3/28/2005 5:40:25 PM
Reply:

Similar Artilces:

How to get the row index of a selected row in listview control
Can someone please tell me how to get the index of a selected row in a listview.  <ItemTemplate> <asp:LinkButton runat="server" class="linkButton" id="xxxxx" Text='<%#Eval("documenttype") %>' CommandName="OpenFile" CommandArgument='<%#Eval("DocumentKey") %>'></asp:LinkButton></ItemTemplate>what you have to do is, in itemcommand event of ListView, you have to get the value of row indexif(e.CommandName == "corrospondingcommaandname"){     &nb...

How to delete row from GridView control
Hello,  I am working on an ASP.NET 2.0 app, and I am trying to wire up a "Delete" button to a gridview control on a form. Here is the code for the ASP :  <asp:GridView ID="gvInConditions" runat="server" AutoGenerateColumns="true" OnRowDeleting="gvInConditions_RowDeleting" DataKeyNames="Condition_ID" >         <Columns>                <asp:CommandField ButtonType="Button" SelectText=&...

To get the row index of selected row in grid view
Hi I have a grid view with a column of checkboxes. if I check a checkbox all the remaining checkboxes should be unchecked except the current one.protected void chkHeadCoach_CheckedChanged(object sender, EventArgs e) {foreach (GridViewRow rowitem in grdv.Rows) {CheckBox chkHeadCoach = (CheckBox)(rowitem.FindControl("chkHeadCoach"));if (chkHeadCoach.Checked) {if(rowitem.RowIndex != //row index of the row I checked now) {chkHeadCoach.Checked = false; } } } how can I get the row index of the row I checked now? }Thanks & Regards,Abhiram Reddy Mekha. AbhiramReddyMekh...

get row index of row from datatable from primary key
How get row index of particular row from datatable for eg.        i have create table of following column and fill rows in that and bind it into gridview            now i want to get row index of selected row from column LedgerDetailID , how and reply me             DataTable tbl = new DataTable();            tbl.Columns.Add(new DataColumn("Index", System.Type.GetType("System.Int32"))); ...

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

how do I get the row index of the row that was just updated in the row_updated function?
How do I get the row index of the row that was just updated in the row_updated function?  Please don't tell me to use the row updating function because I tried to do what I want under row_updating but it doesn' t work for what I need to do.   Thanks. aspusername: Please don't tell me to use the row updating function Sorry, but that's where the information is: int LastRowUpdated; protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { LastRowUpdated = e.RowIndex; } protected void GridView1_RowUpdated...

how can i get index of row in grid by clicking on grid row
how can i get index of row in grid by clicking on grid row Hi there,Under the selectedindexchanged event of the gridview put this:protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { int index= GridView1.SelectedIndex;//to get the indexGridViewRow row= GridView1.SelectedRow; //to get the selected row} thanks,Murthy Dont forget to click "Mark as Answer" on the post that helped you. This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. Once you get the index of the row, how do ...

Getting the row index of a command in gridview control
In my gridview I have a textbox and a save icon which allows a user to enter a date and click save which saves the date to the database for that record pointed to in the row. The problem I have is that I don’t know how to get the row to process the save in the codebehind. Normally I would set the command-argument equal to the product ID and then in the codebehind handle the event where the commandname matches the commandname for the save icon. I have the problem then though of not knowing which row caused the event. If I use a buttonfield, I know it sets the commandargument to the row index...

get the row element values using row index for dynamic dropdownlist using javascript
Friends,How to get the row element values using row index for dynamic dropdownlist using javascript ?Thanks in advance  I want creating dynamic dropdownlist  using javascript. I am working on deleting a row. function DeleteRow(r) { var i = r.parentNode.parentNode.rowIndex;document.getElementById("ctl_Contentmain_tbldynamic").deleteRow(i);var str = document.getElementByName("ddljobs");   alert(str); } Check out this. var str = document.getElementById('<%=ddljobs.ClientID%>');   Thanks,santosh_maharajaPlease mark as answer ...

How to set the row number and get the row number for ("selected row) in Datagrid
I face a problem that i can't get the selected row of the datagrid in both server side script (VB.net) and client side script (javascript) As i can't use the button column / hyperlink column in the datagrid. Thus , i need to handle the change the background color of the selected row and also to get the selected row number for Update/Delete. Thanks in advance. This depends on how do you perform the selection. Do you want to implement chaning of the SelectedRow at the client side without any postback? If you have no issues with postback, then you can do s little trick here: 1. ...

First Row, Next Row, Prior Row, Last Row
I have a SQL Anywhere 7.0 Database, have a table Product_detail which contains Column Name Datatype width Null Default batch_id char(10) No None prod_id Integer No None employee_id Integer No None quantity Integer No None price Numeric (14, 2) No None Its primary key is batch_id I have a Freeform Datawindow with this table I want to provide the first row, next row, prior row and last row Ho...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column. Without editing the grid view i want to know the selected index of dropdownlistbox for each row. Simply itearte through the Rows collection of your GridView. Then, use the FindControl method of the GridViewRow reference and retrieve a reference to your DropDownList. From here, you can then retrieve your SelectedIndex. This can be done within the GridView.DataBound event or later.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column.  Without editing the grid view i want to know the selected index of dropdownlistbox for each row. See http://forums.asp.net/t/1170088.aspx.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

Get the Row Number or Row ID
Hi, I am using Sybase Central v4.3 with Interactive SQL to query the SQL Commands. My concern is how to get the rownumber or row id in select queries. Is there any in built commands in the ASE. If not please suggest me how to get the rownumber. Thanks.... Unless i'm mistaken, ASE does not use a rowid... it can have a timestamp, but it is updated with every modification to the row. http://infocenter.sybase.com/help/topic/com.sybase.help.ase_15.0.blocks/html/blocks/blocks34.htm -- Cory Sane [TeamSybase] Certified Sybase Associate DBA for ASE 15.0 "Santhanam P" wrote...

Web resources about - Get row index of found row - asp.net.presentation-controls

Steve Jobs Keynote Index Fund
Back in 2007 (and linked from DF at the time), Matt Haughey had this idea: I wondered what effect the Jobs keynote had on Apple’s stock price ...

Money Flow Index
Tuesday, 26 May 2015 Home About us Contact Information Privacy Policy Terms of Service Menu Home Business Economy US Europe Markets Politics ...

City Index UK - Spread Betting, CFD & FX trading
One of the leading UK providers of spread betting and CFD trading, City Index has over 30 years' industry experience.

California Birth Index - Wikipedia, the free encyclopedia
The California Birth Index ( CABI ) is a database compiled by the California Office of Health Information and Research. The index contains birth ...

NAB anxiety index: jobs secure but cost of living makes us anxious
Australians are more secure about their jobs than a year ago but cost of living pressures remain a headache NAB's "consumer anxiety index" slipped ...

Royal Flying Doctors soar in Charity Reputation Index
City-dwelling Australians may never need to call on the Royal Flying Doctor Service for help but they have shown their support for the group ...

NAB anxiety index: jobs secure but cost of living makes us anxious
Australians are more secure about their jobs than a year ago but cost of living pressures remain a headache

Dan Nathan Sees Unusual Options Activity In iShares FTSE/Xinhua China 25 Index
MidSouth Newz Dan Nathan Sees Unusual Options Activity In iShares FTSE/Xinhua China 25 Index Benzinga On CNBC's Options Action, Dan Nathan ...

Philly Fed Back in Contraction, Index Below Any Economist's Guess
... half of story for the December Philly Fed report which is pointing to another rough month for the nation's factory sector. The headline index ...

U.S. Index Futures Hold Higher Before Draghi Amid ECB Rate Moves
Fortune U.S. Index Futures Hold Higher Before Draghi Amid ECB Rate Moves Bloomberg U.S. index futures remained higher after the European Central ...

Resources last updated: 12/27/2015 8:40:05 PM