How to get the value of checkbox in the DataGridView?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none

<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue
<p style="margin-bottom:0.0001pt <span style="color:#0000ff <span style="font-size:9.5pt; line-height:normal Help me plz, when am tick the <span style="color:#0000ff; font-size:small <span style="line-height:normal check box<span style="color:#0000ff <span style="font-size:9.5pt; line-height:normal in
grid i need the value 1 otherwise 0
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue .this code only gave me 0
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue #.aspx
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue <<span style="font-size:9.5pt; font-family:Consolas; color:maroon asp<span style="font-size:9.5pt; font-family:Consolas; color:blue :<span style="font-size:9.5pt; font-family:Consolas; color:maroon GridView<span style="font-size:9.5pt; font-family:Consolas
<span style="color:red ID<span style="color:blue ="grdStudentAttendanceDetails"
<span style="color:red runat<span style="color:blue ="server" <span style="color:red
AutoGenerateColumns<span style="color:blue ="false" <span style="color:red
CellPadding<span style="color:blue ="10" <span style="color:red CellSpacing<span style="color:blue ="10"
<span style="color:red HorizontalAlign<span style="color:blue ="Center
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue <<span style="font-size:9.5pt; font-family:Consolas; color:maroon Columns<span style="font-size:9.5pt; font-family:Consolas
<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon BoundField
<span style="color:red HeaderText<span style="color:blue ="StudentId"
<span style="color:red DataField<span style="color:blue ="StudentId"
<span style="color:blue />
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon BoundField
<span style="color:red HeaderText<span style="color:blue ="StudentName"
<span style="color:red DataField<span style="color:blue ="StudentName"
<span style="color:blue />
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas

<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField
<span style="color:red HeaderText<span style="color:blue ="StudentImage"
<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon ItemTemplate <span style="color:blue
>
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon Image
<span style="color:red ID<span style="color:blue ="ImageStudentId"
<span style="color:red runat<span style="color:blue ="server" <span style="color:red
ImageUrl<span style="color:blue =<span style="background:yellow <%<span style="color:blue #Eval("StudentImage")<span style="background:yellow %><span style="color:blue
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:red Height<span style="color:blue ="100" <span style="color:red
Width<span style="color:blue ="100" <span style="color:blue />
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon ItemTemplate<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField
<span style="color:red HeaderText<span style="color:blue ="FNPresent"
<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon ItemTemplate <span style="color:blue
>
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon CheckBox
<span style="color:red ID<span style="color:blue ="chk_FNPresent"
<span style="color:red runat<span style="color:blue ="server"/>
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon ItemTemplate<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField
<span style="color:red HeaderText<span style="color:blue ="ANPresent"
<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon ItemTemplate <span style="color:blue
>
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
<<span style="color:maroon asp<span style="color:blue :<span style="color:maroon CheckBox
<span style="color:red ID<span style="color:blue ="chk_ANPresent"
<span style="color:red runat<span style="color:blue ="server"/>
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon ItemTemplate<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon asp<span style="color:blue :<span style="color:maroon TemplateField<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas <span style="color:blue
</<span style="color:maroon Columns<span style="color:blue >
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none

<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue #.aspx.cs
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none

<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas; color:blue foreach<span style="font-size:9.5pt; font-family:Consolas (<span style="color:#2B91AF GridViewRow Row
<span style="color:blue in grdStudentAttendanceDetails .Rows)
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas {
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:#2B91AF CheckBox chk_FNPresent=(<span style="color:#2B91AF CheckBox)Row.FindControl (<span style="color:#A31515 "chk_FNPresent");
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:blue if(chk_FNPresent.Checked)
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas {
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas objManageClassIncharge .FNPresent =<span style="color:#A31515 "1";
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas }
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:blue else
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas {
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas objManageClassIncharge .FNPresent =<span style="color:#A31515 "0";
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas }
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:#2B91AF CheckBox chk_ANPresent = (<span style="color:#2B91AF CheckBox)Row.FindControl(<span style="color:#A31515 "chk_ANPresent");
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:blue if (chk_ANPresent.Checked)
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas {
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas objManageClassIncharge.ANPresent =
<span style="color:#A31515 "1";
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas }
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas
<span style="color:blue else
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas {
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas objManageClassIncharge.ANPresent =
<span style="color:#A31515 "0";
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas }
<p style="margin-bottom:0in; margin-bottom:.0001pt; line-height:normal; text-autospace:none
<span style="font-size:9.5pt; font-family:Consolas }
<br/>

View the full article
 
Back
Top