I have set count of values in row and table wise values but my link button not working.
While I have click on number of count LinkButton then page direct in Details1.aspx with details but it’s not working.
Response.Redirect("Details1.aspx");
Please help me.
protected void OnLeadLag(object sender, EventArgs e)
{
GridViewRow row = (sender as LinkButton).NamingContainer as GridViewRow;
string department = row.Cells[0].Text.Trim();
string Month = ddl_Month.SelectedItem.Text.Trim();
string Deviation = (row.FindControl("Deviation") as LinkButton).Text.Trim();
string Fire = (row.FindControl("Fire") as LinkButton).Text.Trim();
string NonReportable = (row.FindControl("NonReportable") as LinkButton).Text.Trim();
string Near_miss = (row.FindControl("Near_miss") as LinkButton).Text.Trim();
string First_Aid = (row.FindControl("First_Aid") as LinkButton).Text.Trim();
string Reportable = (row.FindControl("Reportable") as LinkButton).Text.Trim();
string Fatal = (row.FindControl("Fatal") as LinkButton).Text.Trim();
string Training = (row.FindControl("Training") as LinkButton).Text.Trim();
Session["Department"] = department;
Session["Month"] = Month;
if ((sender as LinkButton).CommandName == "Deviation")
{
Session["Deviation"] = Deviation;
}
if ((sender as LinkButton).CommandName == "Fatal")
{
Session["Fatal"] = Fatal;
}
if ((sender as LinkButton).CommandName == "Fire")
{
Session["Fire"] = Fire;
}
if ((sender as LinkButton).CommandName == "NonReportable")
{
Session["NonReportable"] = NonReportable;
}
if ((sender as LinkButton).CommandName == "Near_miss")
{
Session["Near_miss"] = Near_miss;
}
if ((sender as LinkButton).CommandName == "First_Aid")
{
Session["First_Aid"] = First_Aid;
}
if ((sender as LinkButton).CommandName == "Reportable")
{
Session["Reportable"] = Reportable;
}
if ((sender as LinkButton).CommandName == "Training")
{
Session["Training"] = Reportable;
}
if ((sender as LinkButton).CommandName == "TBT_Pep_Talk")
{
Session["TBT_Pep_Talk"] = Reportable;
}
Response.Redirect("Details1.aspx");
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CssClass="auto-style11"
Height="126px" Width="371%" ShowFooter="true" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:BoundField DataField="DEPARTMENT" HeaderText="DEPARTMENT" />
<asp:TemplateField HeaderText="Deviation">
<ItemTemplate>
<asp:LinkButton ID="Deviation" Text='<%# Eval("Deviation") %>' runat="server" CommandName="Deviation" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Near miss">
<ItemTemplate>
<asp:LinkButton ID="Near_miss" Text='<%# Eval("Near miss") %>' runat="server" CommandName="Near_miss" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Aid">
<ItemTemplate>
<asp:LinkButton ID="First_Aid" Text='<%# Eval("First Aid") %>' runat="server" CommandName="First_Aid" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fire">
<ItemTemplate>
<asp:LinkButton ID="Fire" Text='<%# Eval("Fire") %>' runat="server" CommandName="Fire" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Training">
<ItemTemplate>
<asp:LinkButton ID="Training" Text='<%# Eval("Training") %>' runat="server" CommandName="Training" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="TBT/Pep Talk">
<ItemTemplate>
<asp:LinkButton ID="TBT_Pep_Talk" Text='<%# Eval("TBT_Pep_Talk") %>' runat="server" CommandName="TBT_Pep_Talk" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Non-Reportable">
<ItemTemplate>
<asp:LinkButton ID="NonReportable" Text='<%# Eval("Non-Reportable") %>' runat="server" CommandName="NonReportable" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Reportable">
<ItemTemplate>
<asp:LinkButton ID="Reportable" Text='<%# Eval("Reportable") %>' runat="server" CommandName="Reportable" footertext="Grand Total:" footerstyle-font-bold="true" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fatal">
<ItemTemplate>
<asp:LinkButton ID="Fatal" Text='<%# Eval("Fatal") %>' runat="server" CommandName="Fatal" showfooter="true" autogeneratecolumns="false" />
</ItemTemplate>
<FooterTemplate>
<div style="padding: 0 0 5px 0">
<asp:Label ID="lblPageTotal" runat="server" />
</div>
<asp:Label ID="lblTotal" runat="server" />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Total" HeaderStyle-CssClass="VerticalColumn">
<ItemTemplate>
<asp:Label ID="lblTotal" runat="server" />
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblFTotal" runat="server" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>