|
Forums » .NET » ASP.NET »
Posted Date: 20 Jul 2012 Posted By:: Ranipriya Member Level: Gold Member Rank: 189 Points: 5
Responses:
3
|
Hi all,
I have one gridview and inside that a dropdownlist is binding.
Grid Listing Students id and name and status(present or absent).
allow page indexing is true..So the student list is exceeding 1 page.. By default 1 page contains 10 rows..I have 30 students and this displaying in 3 pages ..
When I changing student of first page status as absent then next page changes. But saving only current page changes only.Can any body knows?
foreach (GridViewRow gvRow in GridAttendance.Rows) {
BOAttendance.StudentId =int.Parse(GridAttendance.Rows[gvRow.RowIndex].Cells[1].Text.ToString()); BOAttendance.StudentName = GridAttendance.Rows[gvRow.RowIndex].Cells[2].Text.ToString(); var status = (DropDownList)GridAttendance.Rows[gvRow.RowIndex].Cells[3].FindControl("ddlstatus" ); BOAttendance.Status = status.SelectedValue.ToString(); var Rem = (TextBox)GridAttendance.Rows[gvRow.RowIndex].Cells[4].FindControl("txtRemark"); BOAttendance.Remark = Rem.Text.ToString(); EffectedRowSave = DALAttendance.AddAttendanceDetails(BOAttendance); }
My problem is foreach (GridViewRow gvRow in GridAttendance.Rows) here I am getting only 10 rows ie,current page..
Anybody have solution?
"Enjoy the World of IT"
Ranipriya
|
Responses
|
#681303 Author: Ajatshatru Upadhyay Member Level: Gold Member Rank: 20 Date: 21/Jul/2012 Rating:  Points: 2 | Hi,
Yes, it would change current page only and it should exactly do this. Why you want other pages, when you are updating only one row? As far as my understanding is concerned about your process, you are editing one student "status" as "absent". So in this case only this record should get affected, which is I think happening.
Please correct me if I am not getting you thoroughly with some details of your requirement.
Hope it'll help you. Regards Ajatshatru
| #681366 Author: Ranipriya Member Level: Gold Member Rank: 189 Date: 22/Jul/2012 Rating:  Points: 1 | Hi,
I have 30 students to mark the attendance..
3 students are absent.
when I started to mark the attendance,Gridview paging is true,so that students are displaying in 3 pages ie,first 10 students in first page,second 10 students in 2nd page and so on..
The absent students are in first,second,and third pages..
I have marked one student as absent and moving to next page automatically the changes in first page is remain same,my changes are not affecting and I marked 27th student in 3rd page and saved ..but the grid saves only that current pages information only.not in first page and second..Very critical issue,because attendance we have to mark correctly
"Enjoy the World of IT"
Ranipriya
| #681476 Author: Ajatshatru Upadhyay Member Level: Gold Member Rank: 20 Date: 23/Jul/2012 Rating:  Points: 3 | Hi,
First of all sorry for responding late.
Okay, for such a situation best way would be save individual record on drop down list selected index changing. Whenever user select the attendance from drop down list, just handle the selected index change event of drop down list and update the database.
Let me know if you have any doubts or any issue in doing that.
Hope it'll help you. Regards Ajatshatru
|
|
| Post Reply |
|
|
|
You must Sign In to post a response.
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|