publicuse vs

publicuse vs

  • NA
  • 400
  • 909

Hello Respected i am getting result always false using grid

May 18 2019 4:57 AM
<asp:GridView ID="grdsave" runat="server" AutoGenerateColumns="false" DataKeyNames="id" OnPageIndexChanging="grdsave_PageIndexChanging" OnRowCancelingEdit="grdsave_RowCancelingEdit" OnRowDeleting="grdsave_RowDeleting" OnRowEditing="grdsave_RowEditing" OnRowUpdating="grdsave_RowUpdating">
<Columns>
<asp:TemplateField HeaderText="S.No.">
<HeaderTemplate>S No.</HeaderTemplate>
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
</ItemTemplate>
<HeaderStyle></HeaderStyle>
<ItemStyle Height="20px"></ItemStyle>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:HiddenField ID="hf_Id" runat="server" Value='<%# Eval("ID") %>' />
<center>
<a rel="launch" class="cboxElement" href='<%# Eval("sImage").ToString() == "" ? "../CriminalsPhoto/criminalsnot.jpg" : "../CriminalsPhoto/"+Eval("sImage") %>'>
<img id="Img1" class="imgbdrcenter" alt="CriminalsImages" src='<%# Eval("sImage").ToString() == "" ? "~/PoliceUser/CriminalsPhoto/criminalsnot.jpg" : "~/PoliceUser/CriminalsPhoto/" + Eval("sImage")%>'
runat="server" width="100" height="100" /></a><br />
<a href="AddPhonno.aspx?Crmid=<%# Eval("ID")%>"></center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Criminal ID" ItemStyle-Width="60">
<ItemTemplate>
<asp:Label ID="id" runat="server" Text='<%# Eval("id") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name" ItemStyle-Width="150">
<ItemTemplate>
<asp:Label ID="Name" runat="server" Text='<%# Eval("Name") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Father Name" ItemStyle-Width="150">
<ItemTemplate>
<asp:Label ID="FName" runat="server" Text='<%# Eval("FName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Age " ItemStyle-Width="20">
<ItemTemplate>
<asp:Label ID="age" runat="server" Text='<%# Eval("age") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cast " ItemStyle-Width="60">
<ItemTemplate>
<asp:Label ID="cast" runat="server" Text='<%# Eval("cast") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Address " ItemStyle-Width="180">
<ItemTemplate>
<asp:Label ID="address" runat="server" Text='<%# Eval("address") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PresentStatus " ItemStyle-Width="30">
<ItemTemplate>
<asp:Label ID="PresentStatus" runat="server" Text='<%# Eval("PresentStatus") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:CheckBoxField DataField="CheckBox1" HeaderText="Is Top Ten" />--%>
<asp:TemplateField HeaderText="Is Top Ten">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" runat="server" commandname="CheckBox1" Height="32px" Width="32px"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</div>
 
 
 
 
foreach (GridViewRow row in grdsave.Rows) //Running all lines of grid
{
if (row.RowType == DataControlRowType.DataRow)
{
CheckBox chkRow = (row.Cells[0].FindControl("CheckBox1") as CheckBox);
if (chkRow.Checked)
{
//if checked do something
}
}
}
}
 

Answers (1)