Forms Data Controls :: Set FormView PageIndex By DataKey Of Row?

Mar 17, 2010

Does any one know how set the FormView PageIndex to a DataItem with a specified DataKey?

Like:

DataKey dataKeyVal = myGridView.SelectedDataKey.value
myFormView.PageIndex = FormView.DataItems.GetByDataKeyVal(DataKey dataKeyVal).Index

The FormView is bound to the same ObjectDataSource as the GridView and the FormView uses the autoPaging so I can't just use a separate DataSource for the FormView with just one parameter being the ID.

There must be a way to set the FormView PageIndex by a Datakey value.

View 4 Replies


Similar Messages:

Forms Data Controls :: Why Set FormView PageIndex Is So Slow

Feb 16, 2010

I just use a FormView to display the data. When I tried to set the PageIndex at Page Load, it is quick to get the PageIndex value from database. But it took 2 seconds to set the PageIndex.

FormView binding to a List collection which get from Database (It is quick to get the data from database)

View 1 Replies

Forms Data Controls :: Set FormView PageIndex By DataValue Or SelectedValue?

Nov 29, 2010

There has to be a solution.I've been trying to figure this out for a year.This is my current code:

protected void gvTicketList_SelectedIndexChanged(object sender, EventArgs e)
{
// Get the SelectedDataKey of the selected Ticket in GridView

[code]...

View 17 Replies

Forms Data Controls :: Assign Gridview Datakey To Formview Textbox?

Jan 31, 2010

I have a gridview table and i need to select one record and insert the Datakey of the selected record to a formview textbox control. I'm completely lost...

View 13 Replies

Unable To Get The Datakey Value Of A Selected Row In GridView For Use In FormView

Sep 15, 2010

I have a gridview like this :

[code]....

I have done this before "n" number of times but I am not able to get it working this time. The trouble is that when the call for the Select Method of the formview goes to the relevant function - "GetCustomerByCusnum" I have a null value in its parameter "cusnum".

I know that I can write a selecting event and using CommandArgument, parse the value of the selected row and pass it into the Select method as a value but I dont want that solution. I know it works without the "Selecting" method but I cant recall how.

View 1 Replies

Forms Data Controls :: PageIndex Changing On Postback?

Nov 8, 2010

I m having Gridview in Update Panel. If I select page 2, I want to update few contents in the same page. I m using Update panel for those contents.

<tr><td colspan="2" align="center">
<asp:UpdatePanel runat="server" ID="UpdatePanel3" UpdateMode="Conditional">
<Triggers><asp:AsyncPostBackTrigger ControlID="GridView1" EventName="---" /></Triggers>
<ContentTemplate>
<div style="border:1px solid #000; width:300px; height:35px;" runat="server" id="divSelectedRecords">
</div></ContentTemplate>
</asp:UpdatePanel></td>
</tr>

What event Name I have to give in Trigger?

View 3 Replies

Forms Data Controls :: Move To Particular Pageindex In Gridview?

Sep 11, 2010

I have one textbox one button and one gridview on my webform, when Page loads all records are displayed on gridview, which works perfectly fine, now,I search particular records by entering id in textbox, which finds particular records and found row's background becomes red.which works perfectly fine too, my gridview's pagesize is 15 which means it display 15 records per page, Now,Problem is when i enter ID textbox to search record,but searched record is on another page,so,I want that When i click button to search, the page must be displayed where searched record exist. It displays first page even after search, How can i move to that page where record exist. what i have to code in click event

View 3 Replies

Forms Data Controls :: How To Pass The PageIndex Of A GridView From One Page To Another

May 24, 2010

I have a GridView which contains photographs.

Each row has a "View Large" link which passes the image id to another page whereupon the image is displayed in a DetailsView.

That page has a "back to album" hyperlink.

All this works nicely, however, no matter what page the user was on in the GridView, having clicked through to the DetailsView and then back to the GridView, the user ends up on page 1 of the GridView.

How can I ensure the user comes back to the same page in the GridView that they were on when they clicked through to the DetailsView? Do I need to pass the gv.PageIndex value and send it back; can I just somehow tell the GridView to "stay where it was"?

Here's the code for the GridView (it pulls the image info from a SQL db:

[Code]....

View 21 Replies

Forms Data Controls :: Access GridView PageIndex In Rowdatabound Event?

Feb 5, 2010

How do I access GridView Page Index in RowDataBound event? I am assigning PageIndex to hyperlink on the gridview, for this I was planning to use "GridView1.PageIndex" in rowdatabound event. Problem is when I got second page in gridview (10 rows per page), the first row in the page shows page index as "0" and from second row it becomes 1. And if I goto third page, the first row in the page shows page index as "1" and from second row it becomes 2.

View 13 Replies

Forms Data Controls :: How To Access The Pageindex Gridview Property When Creating A Dynamic Template

Mar 15, 2011

I need to get access to the page index of the gridview so I can correctly get some data from a coresponding array to set the cell's contol properties correctly. Below is what I've got so far. The ExcelObject is a class that houses both the data read in from an sutomer submitted excel file and a matching 2 dimensional array of characteristics that I use in this case to set the CssClass property. My problem is that when I enable paging for the gridview I don't get the proper datasource row index when the data is read by the databinder.eval; what I'm getting is the current row of the gridview being generated.

[Code]....

View 2 Replies

Forms Data Controls :: Get The Gridview Datakey Value?

Jan 5, 2011

I have a gridview with datakey value

in save button click i want to get the gridview datakey value

Dim _id As Integer For Each row As GridViewRow In Me.gridviewi.Rows Next

View 2 Replies

Forms Data Controls :: Getting DataKey Value From GridViewRow?

Mar 9, 2010

I need to loop through all the gridviewrows, and call a function for every row using the datakey. How do I get the datakey of each row?

My code looks something like:

foreach(GridViewRow gvr in GridView1.Rows)
{
DoSomething(gvr.INSERT DATA KEY OF THIS ROW HERE);
}

View 1 Replies

Forms Data Controls :: How To Get GridViewRow From Datakey

Jan 12, 2011

I have the DataKey value, I want to use that to get the GridViewRow and retrieve information from various columns - I see lots on information on how to get the datakey from a gridview row, but not the reverse.

View 4 Replies

Forms Data Controls :: Retrieving Datakey Value In Gridview?

Mar 19, 2010

Tried this but it doesn't work.

[Code]....

Retrieving datakey value in gridview?

View 5 Replies

Forms Data Controls :: Is It Possible To Have The BookId Value As A DataKey Of The GridView

Aug 14, 2010

Lets say for example that I have a book object that looks like this:

[Code]....

And a Page_Load method that bounds a GridView called "gvBooks" from a generic list of books:

[Code]....

Now as you can see, I want to have the BookId value that is part of the Dictionary as a DataKey of the gvBooks GridView.

That piece of code of curse returns an Exception:

"DataBinding: 'GridViewTest.Book' does not contain a property with the name 'BookId'."

My question is: Is it possible to have the BookId value as a DataKey of the GridView?

View 4 Replies

Forms Data Controls :: DataList / DataKey / EditCommand

Mar 15, 2011

I am using Microsoft's method for allowing editing/updating/deleting of a datalist:

<asp:DataList
runat="server"
DataKeyField="ChargeID"
ID="HistoryList"
DataSourceID="SqlDataSource1"
width="650px"

[code...]

I am using the ChargeID as the datakey for editing, etc., but I need to use the UserID to limit what gets populated into the datalist to begin with. I do have a session variable with the UserID, but how do I populate the list with data according to the UserID?

View 6 Replies

Data Controls :: Change First And Last PageIndex Style In GridView Paging JQuery

May 7, 2015

I have gridview in my page that use below code for pagination

<asp:GridView ID="GridView2" runat="server"
AutoGenerateColumns = "false" PagerStyle-CssClass = "GridPager" PagerSettings-Mode="NumericFirstLast" PagerSettings-PageButtonCount = "5"
AllowPaging ="true" OnPageIndexChanging = "OnPaging1" OnRowDataBound = "OnRowDataBound" PageSize = "5" ">
PagerSettings Mode="NumericFirstLast" PageButtonCount="5" FirstPageText="first"
LastPageText="last"></PagerSettings>

[CODE]....

View 1 Replies

Forms Data Controls :: TemplateField In Gridview Not Passing DataKey Value?

Feb 4, 2010

I'm relatively new to the VS environment. I'm using VS2010 Beta 2 with VB. I have a Gridview setup to pull a list of employees. Next to their name I have edit and delete icons. When I leave the icons as ButtonFields, they pass the DataKey value to my code behind perfectly. When I convert the ButtonFields to TemplateFields, they no longer pass the DataKey.

[Code]....

[Code]....

[Code]....

View 2 Replies

Forms Data Controls :: Highlighting A Row In A Gridview Control Using A DataKey In C#

Apr 11, 2010

My gridivew currently has 4 colums with the third being a subject column. I want this colum to have bold text if the datakey 'ReadStatus' is equal to false. I have had success if the column is bound to the gridview but 'ReadStatus' is only a datakey and not bound to the gridiview. My code is below:

[Code]....

[Code]....

View 1 Replies

Forms Data Controls :: Selecting A Datakey From A Template Field

May 19, 2010

i have a gridview that has only one column but multiple rows that i converted into a template column.

I have a linkbutton in this column that when clicked should collect the rows primary data key (forumId) and then insert it into a querystring and redirect to the threads page.

How do i select a datakey in the code behind file for the selected row without using the Selectedindexchanged event handler?

<asp:TemplateField HeaderText="Title" SortExpression="Title">

View 3 Replies

Forms Data Controls :: Programmatically Set GridView.SelectedIndex From Known DataKey

Aug 4, 2010

I want to select a row in my GridView based on a known data key value at runtime.

In other words, I have a data key value, 2 for ex., and the primary key value of one of the rows in my GridView is 2. How can select that row? (Without having to go through each row to find which one matches my key, then setting the SelectedIndex.

View 6 Replies

Forms Data Controls :: Retrieving Datakey, (an ID Value) From GridView Via Check Box?

Apr 13, 2010

I have a GridView with a checkbox for the user to select different categories. I am trying to retrieve the CategoryID associated with each row when the user clicks next, however I keep getting an error that tells me the selected index cannot be negative or out of range.

Here is my function

[Code]....

How do I retrieve the CategoryID of the row as an Integer value?

View 7 Replies

Forms Data Controls :: Determine DataKey For The Row To Be Deleted In GridView?

Jun 14, 2010

I have wired an event to handle delete command for my GridView. But I cannot determine which the record's unique key, in my case stored in DOCIDNO field. All I get is a row index, such as 0, 1, 2 which obviously cannot be used to accurately delete a record from database.

<asp:GridView
ID="gridTimeOff"
runat="server"
HeaderStyle-CssClass="gridHead"
RowStyle-CssClass="gridRow"

[Code].....

View 2 Replies

Forms Data Controls :: Get The DataKey Value In RowDataBound Event For GridView?

Feb 22, 2010

How to get the DataKey value in RowDataBound event for GridView

View 3 Replies

Forms Data Controls :: Get Datakey From Templatefield (dropdownlist) In Gridview

May 21, 2010

I have a gridview with a DropDownList (contained in a TemplateField). I have set the OnSelectedIndexChanged event to a function called "ddlAgent_SelectedIndexChanged" This allows me to aquire when a user has changed the value for the dropdownlist. What I need to do is persist this newly selected value to the database for the gridview record. The problem I'm having is how to I get the datakeyNames value for that row? See code below!

TemplateField source
<asp:TemplateField HeaderText="Agent">
<ItemTemplate>
<asp:DropDownList ID="ddlAgent" runat="server" AutoPostBack="False" OnSelectedIndexChanged="ddlAgent_SelectedIndexChanged">
</asp:DropDownList>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:TemplateField>
ddlAgent_SelectedIndexChanged

Protected Sub ddlAgent_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim gvItems As DropDownList = CType(sender, DropDownList)
' Write the selected Agent ID to the Inquiry record.
'Dim ID As Integer = gvMaint.DataKeyNames(e.SelectedIndex).Value ' THIS FAILS BECAUSE
e.SelectedIndex is not part of System.EventArgs
End Sub

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved