TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Chriz L
NA
220
50.8k
Enable checkbox when user clicks on Edit button (GridView)
Dec 28 2016 5:36 AM
Hello,
I have the following code:
protected
void
gv_RowEditing(
object
sender, GridViewEditEventArgs e)
{
gv.EditIndex = e.NewEditIndex;
ImageButton lnkRowSelection = (ImageButton)sender;
String result = lnkRowSelection.CommandArgument.ToString();
if
(result==
"N/A"
)
//
cbResultManualΝο
on gridView must be set to enable.
//
cbResultManualYes
on gridView must be set to enable.
bindGrid();
}
<
asp:GridView
ID
=
"gv"
runat
=
"server"
AutoGenerateColumns
=
"false"
OnRowCancelingEdit
=
"gv_RowCancelingEdit"
OnRowEditing
=
"gv_RowEditing"
OnRowUpdating
=
"gv_RowUpdating"
CssClass
=
"mTable"
>
<
Columns
>
<
asp:TemplateField
HeaderText
=
"Check"
ItemStyle-Width
=
"25"
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblResultAuto"
runat
=
"server"
Text
=
'<%#Eval("CheckRes") %>'
Width
=
"25"
>
</
asp:Label
>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Valid"
ItemStyle-Width
=
"25"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"lblResultManual"
runat
=
"server"
Enabled
=
"False"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:CheckBox
ID
=
"cbResultManualYes"
runat
=
"server" Enabled="false"
/>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
HeaderText
=
"Not Valid"
ItemStyle-Width
=
"25"
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"lblResultManual1"
runat
=
"server"
Enabled
=
"False"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:CheckBox
ID
=
"cbResultManualΝο"
runat
=
"server" Enabled="false"
/>
</
EditItemTemplate
>
</
asp:TemplateField
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"btnEdit"
Text
=
"Edit"
runat
=
"server"
CommandName
=
"Edit"
/>
</
ItemTemplate
>
<
EditItemTemplate
>
<
asp:LinkButton
ID
=
"btnUpdate"
Text
=
"Update"
runat
=
"server"
CommandName
=
"Update"
/>
<
asp:LinkButton
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CommandName
=
"Cancel"
/>
</
EditItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
How can I enable cbResultManualΝο and cbResultManualΝο when the user clicks on Edit?
Reply
Answers (
5
)
Window command creating a dynamic batch script
Load data table to array and return array using Jquery