Hi ravi.icsil,
I have modified your code please check.
HTML
<div>
<asp:GridView ID="gvStudents" runat="server" AutoGenerateColumns="False" AllowPaging="True"
OnPageIndexChanging="gvStudents_PageIndexChanging" OnRowDataBound="gvStudents_RowDataBound"
PageSize="8" DataKeyNames="staff_id" EnablePersistedSelection="True" EmptyDataText="<p>You Have no Data</p>">
<Columns>
<asp:TemplateField HeaderText="Staff_id">
<ItemTemplate>
<asp:Label ID="lblstaffid" runat="server" Text='<%#Eval("staff_id") %>'></asp:Label></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblstaffname" runat="server" Text='<%#Eval("name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Father's Name">
<ItemTemplate>
<asp:Label ID="lblfname" runat="server" Text='<%#Eval("fname") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="In Time (Optional)">
<ItemTemplate>
<asp:DropDownList ID="ddlInTime" runat="server" AutoPostBack="true">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Out Time(Optional)">
<ItemTemplate>
<asp:DropDownList ID="ddlOutTime" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Attendence">
<ItemTemplate>
<asp:DropDownList ID="AttendanceOption" runat="server">
<asp:ListItem Selected="True" Text="Present"></asp:ListItem>
<asp:ListItem Text="Absent"></asp:ListItem>
<asp:ListItem Text="Half Day Present"></asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<ItemTemplate>
<asp:TextBox ID="txtremarks" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:ScriptManager ID="Scriptmanager1" runat="server">
</asp:ScriptManager>
<asp:Label ID="lblnotify" Text="" runat="server" />
<asp:TextBox ID="txtselectDate" Visible="false" runat="server" />
<asp:UpdatePanel ID="PanelGridData" runat="server">
<Triggers>
<asp:PostBackTrigger ControlID="btnSave" />
<asp:PostBackTrigger ControlID="btnNext" />
</Triggers>
</asp:UpdatePanel>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="SaveStudentAttendance"
CausesValidation="False" />
<asp:Button ID="btnNext" runat="server" Text="Next" CausesValidation="False" OnClick="btnNext_Click"
Width="66px" />
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.GetStudentsDetails();
}
}
private void GetStudentsDetails()
{
DataTable dt = new DataTable();
dt.Columns.Add("staff_id", typeof(int));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("fname", typeof(string));
dt.Rows.Add(1, "Peter", "Peter");
dt.Rows.Add(2, "Maria ", "Maria ");
dt.Rows.Add(3, "Antonio Moreno ", "Antonio Moreno ");
dt.Rows.Add(4, "Thomas Hardy ", "Thomas Hardy ");
dt.Rows.Add(5, "Christina Berglund ", "Christina Berglund ");
dt.Rows.Add(6, "Ann Devon", "Ann Devon");
dt.Rows.Add(7, "Roland Mendel", "Roland Mendel");
dt.Rows.Add(8, "Aria Cruz", "Aria Cruz");
dt.Rows.Add(9, "Diego Roel", "Diego Roel");
dt.Rows.Add(10, "Zbyszek's", "Zbyszek's");
dt.Rows.Add(11, "Rita Müller", "Rita Müller");
dt.Rows.Add(12, "Liz Nixon", "Liz Nixon");
dt.Rows.Add(13, "Christina Berglund ", "Christina Berglund ");
dt.Rows.Add(14, "Ann Devon", "Ann Devon");
dt.Rows.Add(15, "Roland Mendel", "Roland Mendel");
dt.Rows.Add(16, "Aria Cruz", "Aria Cruz");
dt.Rows.Add(17, "Diego Roel", "Diego Roel");
dt.Rows.Add(18, "Zbyszek's", "Zbyszek's");
dt.Rows.Add(19, "Rita Müller", "Rita Müller");
dt.Rows.Add(20, "Liz Nixon", "Liz Nixon");
gvStudents.DataSource = dt;
gvStudents.DataBind();
}
protected void SaveStudentAttendance(object sender, EventArgs e)
{
foreach (GridViewRow row in gvStudents.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
string Astatus = ((row.FindControl("AttendanceOption") as DropDownList).SelectedItem.ToString());
float staffId = float.Parse((row.FindControl("lblstaffid") as Label).Text.Trim());
string Name = ((row.FindControl("lblstaffname") as Label).Text.Trim());
string FName = ((row.FindControl("lblfname") as Label).Text.Trim());
string attendenceDate = (this.txtselectDate.Text.Trim());
string Remarks = ((row.FindControl("txtremarks") as TextBox).Text.Trim());
string InTime = ((row.FindControl("ddlInTime") as DropDownList).SelectedItem.ToString());
string OutTime = ((row.FindControl("ddlOutTime") as DropDownList).SelectedItem.ToString());
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["AISConnectionString"].ConnectionString;
using (SqlConnection con1 = new SqlConnection(constring))
{
string query = "INSERT INTO d_attendance(staff_id,name,fname,dept,c_date,inTime,outTime,status,remarks) VALUES('" + staffId + "','" + Name + "', '" + FName + "', '" + "1212" + "','" + attendenceDate + "','" + InTime + "','" + OutTime + "','" + Astatus + "','" + Remarks + "')";
using (SqlCommand cmd = new SqlCommand(query, con1))
{
con1.Open();
cmd.ExecuteNonQuery();
//Response.Write("<script>alert('Attendance Data Saved for First Page Index. Proceed to next Page Index ')</script>");
lblnotify.Text = "Attendance Data Saved. Please Click Next";
con1.Close();
btnSave.Enabled = false;
btnNext.Enabled = true;
txtselectDate.Enabled = true;
}
}
}
}
}
//End of Code to save each row of grid
//Code behind Next Button
protected void btnNext_Click(object sender, EventArgs e)
{
int a = gvStudents.PageCount;
try
{
if (gvStudents.PageIndex < a)
{
gvStudents.PageIndex = gvStudents.PageIndex + 1;
if (gvStudents.PageIndex + 1 == a)
{
lblnotify.Text = "Last Page";
btnNext.Enabled = false;
}
else
{
lblnotify.Text = "";
btnNext.Enabled = true;
}
this.GetStudentsDetails();
btnSave.Enabled = true;
}
}
catch (Exception ex)
{
if (gvStudents.PageIndex >= a)
{
lblnotify.Text = "You have reached end of grid";
btnNext.Enabled = false;
btnSave.Enabled = false;
}
}
}
protected void gvStudents_RowDataBound(object sender, GridViewRowEventArgs e)
{
}
protected void gvStudents_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvStudents.PageIndex = e.NewPageIndex;
this.GetStudentsDetails();
if (gvStudents.PageCount == gvStudents.PageIndex + 1)
{
lblnotify.Text = "Last Page";
btnNext.Enabled = false;
}
else
{
lblnotify.Text = "";
btnNext.Enabled = true;
}
}
Screenshot

I hope works for you.