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
Md Akmal
NA
354
19.1k
checkbox problem
Apr 30 2018 11:17 PM
i m facing problem Specified cast is not valid.
when i use checkbox in gridview
my code is here..
<
asp:GridView
ID
=
"GridView3"
runat
=
"server"
AutoGenerateColumns
=
"false"
>
<
Columns
>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:CheckBox
ID
=
"CheckBox1"
runat
=
"server"
Checked
=
'<%#Eval("active")%>'
Text
=
'<%#Eval("id")%>'
OnCheckedChanged
=
"CheckBox1_CheckedChanged"
AutoPostBack
=
"true"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
<
asp:BoundField
DataField
=
"name"
HeaderText
=
"Name"
/>
<
asp:BoundField
DataField
=
"address"
HeaderText
=
"Address"
/>
<
asp:BoundField
DataField
=
"city"
HeaderText
=
"City"
/>
</
Columns
>
</
asp:GridView
>
protected
void
CheckBox1_CheckedChanged(
object
sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
string
st =
"0"
;
if
(chk.Checked)
{
st =
"1"
;
}
nc.id = chk.Text;
nc.mode =
"status"
;
nc.active = chk.ToString();
int
eff = nc.manipulatNews(nc);
if
(eff > 0)
{
fil_grid();
}
}
plz help me
thank you
Reply
Answers (
4
)
Updating Master-Detail / Parent-Child data in MVC
routing in mvc5