Forms Data Controls :: Set Current Gridview Page To Selected Row's Page After Sort / Edit?
Jan 20, 2011
I'm new to ASP.net (and coding in general) and I was very impressed about how easy is to learn enough to create something useful :)
Unfortunately, now I'm stuck on a problem involving gridview sorting and paging: I created a master gridview bound to an sqldatasource, I enabled sorting and paging and then I linked it to a detailsview to enable editing and inserting.
In addition, I set up two other gridviews whose datasources depend on the master gridview.
When a user selects a row and modifies it in the detailsview, the sort takes place and the row is often moved to another page. This can be a little confusing, especially because there are other controls relying on the selected row of the master gridview.
There's a way to find and select the page of the selected row after gridview's databind and sort take place? I tried creating a dataview to search the index of the selected datakey in the databound event of my gridview, but it doesn't work, because it seems that the rows aren't sorted yet. Maybe I should choose another event?
View 10 Replies
Similar Messages:
Apr 22, 2010
I have the following sorting code that works find when clicking on a column header in a gridview.
Now, I'd like to fire this sorted table & fire it on load instead of having the user have to click a column heading.
how to do that?
Here's my code:
[Code]....
View 3 Replies
Mar 26, 2010
i have a gridview that has the ability to sort by each of the columns, but suppose if i'm on page 2 of the results and sort any of the columns, it jumps back to page 1. is there a way to keep it on page 2, still have the sorted date work?
View 3 Replies
Sep 30, 2010
I have two gridviews on same page - If a record is selected in Gridview1, I need to unselect a record (if one is selected) in Gridview2 - and vice-versa.
View 5 Replies
Apr 9, 2010
I have a GridView known as GV_R001 with IssueType, ActID, IssueID cells. I want to Merge the similar IssueType cell accordingly. How do i merge and also sort the IssueType cell accordingly. The following is my codes:
Protected Sub GV_R001_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GV_R001.DataBound
For rowIndex As Integer = GV_R001.Rows.Count - 2 To 0 Step -1
Dim gvRow As GridViewRow = GV_R001.Rows(rowIndex)
Dim gvPreviousRow As GridViewRow = GV_R001.Rows(rowIndex + 1)
Dim cellCount As Integer = 0
If gvRow.Cells(cellCount).Text = gvPreviousRow.Cells(cellCount).Text Then
If gvPreviousRow.Cells(cellCount).RowSpan < 2 Then
gvRow.Cells(cellCount).RowSpan = 2
Else
gvRow.Cells(cellCount).RowSpan = gvPreviousRow.Cells(cellCount).RowSpan + 1
End If
gvPreviousRow.Cells(cellCount).Visible = False
End If
Next
End Sub
Apart from that, after sorting i want to calculate the amount of IssueID are in a particular IssueType and display in a cell called "Total". Is it possible to do so? By the way, I am using Web Developer 2008, VB.net.
View 2 Replies
Jan 10, 2011
I have grid view with different page index Based on the Page Number i have to enable different panel.
If page Index is 1 I have to enable Panel 4 If page Index is 5 I have to enable Panel 1 and Link Buttons like in such a way.
Dynamically needs to be updated based on the Grid View page number.
View 5 Replies
Dec 2, 2010
I have a 2 pages
one is registration page and second is show data in grid view
When i click on Edit button of gridview row i want to fill textboxes of registration page
how to do it?
View 3 Replies
Jan 17, 2011
Is there a way which allows me to save the current page of a GridView as an image?
View 2 Replies
Nov 30, 2010
How can I edit a gridview row in different page?
View 1 Replies
Feb 25, 2010
Initially I display all the records in the gridview. Then based on the search I fetch certain records and display it.. When I try to edit any retrieved record, the control automatically tries to edit the first record instead of editing the selected record.. What should I change in the code to make it work?
Here is the code behind
[Code]....
[Code]....
[Code]....
View 3 Replies
Jan 29, 2010
I have a page with a gridview control that shows files that have been uploaded to our site. The name of the uploaded files, who uploaded them, and if they have been downloaded, etc are stored in a table. The gridview is bound to the table through a sqlDataSource control. I have a button column in the gridview that downloads the file associated with a row when the button is clicked. All that works well. I have a check box column that shows checked if a file has been downloaded. When the download button is pressed.
the file downloads and then a short routine is run to update the downloaded field in the uploaded files table to set the downloaded field to true. This is done through a command string. All this works. Here is the question. After the update is run I do a databind on the gridview to update it. The databind is run in the PageLoad event is the page is a postback. This does not cause the current row to show downloaded =true (checked). If I refresh the page in the browser then it displays correctly.
View 6 Replies
Jan 9, 2010
im not sure why but my gridview seems to have stopped working in all areas of Editing, Deleting, Sortinging and i cant click the page number to switch between pages.Ive looked up numerous tutorials and on forums and still cant seem to find a solution that works for me. I have the edit delete sorting and paging check boxes selected.
When i click on any of the links nothing happens. not even a refresh.
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="NumofPosts"
DataSourceID="SqlDataSource1" [code]......
View 6 Replies
Mar 7, 2010
get the current selected row in the RowCommand event of a GridView in asp.net. The GridView has a button in an Item Template as shown below,
[Code]....
that I can pass values from GridView to a page. I tried following code but I could
not get the row number.
View 4 Replies
Jan 4, 2013
i need to sort the gridview based on the radiobuttons. and i have 3 radiobuttons like dept,empcode,reporter..
if i click on any of radiobutton i need to show the gridview by sorting order..
View 1 Replies
Aug 23, 2010
I would like to know how can i pass a selected row from one gridview to another one in the same page?
View 7 Replies
Sep 23, 2010
Just spent about 8 hours googling and looking through this forum for a solution on how to make sure that I can dynamically sort. Here is the situation.
I have 1 Gridview that displays 10 different scenarios based on what button is clicked.
I am also returning only top 10 records. I am doing all of the data binding pragmatically. So I have BoundFields, HyperLinkFields etc.
I also want to sort some records. When I change DataSource SQL statement the gridview somehow remembers what the last sort value was and it errors out saying that value "x" cannot be sorted because it does not exists.
I tried this:
Tried setting gridview1.sqldatasourceid = null; gridview1.allowsorting = false; gridview1.databind();
Here I get an error that says that the data source does not support sorting? Doesnt it say gridview1.allowsorting = false;
I also tried gridview1.sort("", SortDirection.Ascending); This does nothin... except query my database one more time because i have a onSorting event that looks like this:
[Code]....
Here is an example of just one of those SLQ statements inside GetSQLQuery:
[Code]....
View 1 Replies
Jun 3, 2010
i am creating a print view using checkboxes that a customer uses to select which items they wish to print. I am having difficulty transfering the selected gridview items to another page. I was using crosspage post.
View 2 Replies
May 7, 2015
How to Edit or update gridview to another page in asp.net
View 1 Replies
Aug 23, 2012
How all rows in a gridview be updated with an update button
How all rows can become editable with an edit button on a page?
View 1 Replies
Mar 12, 2010
[Code]....
I am trying to put the select command in code behind:
sdsAdd.SelectCommand = String.Format("SELECT Classes.ClassId, Committed, CallNumber, SubjectArea, CourseNumber, SectionNumber, GradingBasis, NumberOfUnits, NetId FROM Classes INNER JOIN EnrollmentAdjustmentClasses ON EnrollmentAdjustmentClasses.ClassId=Classes.ClassId
WHERE AllFormsId='4' AND SectionId='1' AND NetId=@NetId AND Committed='True' AND EnrollmentAdjustmentClasses.FormId={0}", Request.QueryString["FormId"].ToInteger32());
gvAdd.DataBind();
When I do that, then click edit to edit the selected item, the item disappears from my gvadd. What am I doing wrong?
View 3 Replies
Jan 7, 2014
I have a gridview on which i have kept some search criteria and when i search something and edit it the page refreshes and edit is start from record 1
I am editing directly in gridview ....
View 1 Replies
Oct 9, 2013
I currently have a GridView control on my aspx page with paging enabled and I need to loop through the entire row collection/count to process the selected records. With my current code, it will only loop through the current page of GridView row.
foreach (GridViewRow data in grid.Rows)
{
//here is my code
}
View 1 Replies
Aug 27, 2010
I am having 2 web formsand will have a drop down list on those web forms. If i select a value from drop down and click on ok i will get tranfer to next page. In that page i will have a drop down with the same values in the previous form . What i need is i would like to disable the selected value in the previos form and would like to display the remaining normal.
View 3 Replies
Jun 16, 2015
how we can open gridview in edit mode on page load.
View 1 Replies
Aug 10, 2010
I have a web user control with DataList control in it. In my .aspx page, I have a report header, an empty panel as a place holder, a report footer.In my .aspx.vb file, I'll loop through a list of departments. Within each department, I'll load a label to display the department name and the user control for the data, and add both the label and user control to the panel. So there are two variables:
the number of departments and the number of records in a user control.
Now I need to display the current page number and the total page number in the report footer. Is it doable? How? I'm thinking of this approach: declare a page variable count, count the number of department name labels and the number of records in a user control. When the total count reaches a number, such as 20, I'll break the page. This way, I can get the the page current number and the total number of pages. But how to add a page break to an asp.net page?
View 8 Replies