Checkboxfield in GridView
-
Hi! How can I create a ItemTemplate Checkbox that that gets the data from a database and display only the checkboxes and not the TRUE or FALSE text. The Code I currently have looks like this:
If I change the "Text" to "Checked" I get a Cast error. Can anyone please help?
Illegal Operation
-
Hi! How can I create a ItemTemplate Checkbox that that gets the data from a database and display only the checkboxes and not the TRUE or FALSE text. The Code I currently have looks like this:
If I change the "Text" to "Checked" I get a Cast error. Can anyone please help?
Illegal Operation
Use ctype function.
Be an Eagle, Sky is Yours.
-
Use ctype function.
Be an Eagle, Sky is Yours.
and that would mean? I am using C#
Illegal Operation
-
Hi! How can I create a ItemTemplate Checkbox that that gets the data from a database and display only the checkboxes and not the TRUE or FALSE text. The Code I currently have looks like this:
If I change the "Text" to "Checked" I get a Cast error. Can anyone please help?
Illegal Operation
Illegal Operation wrote:
Use
Checked
Property for that. Like :DBField
should the field of your database.It will resolve your issue.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you. -
Hi! How can I create a ItemTemplate Checkbox that that gets the data from a database and display only the checkboxes and not the TRUE or FALSE text. The Code I currently have looks like this:
If I change the "Text" to "Checked" I get a Cast error. Can anyone please help?
Illegal Operation
Try this:
<asp:CheckBox ID="chkLunch" runat="server" Checked='<%# Convert.ToBoolean(Eval("IsLunch")) %>' />
This should work provided IsLaunch should return value that is convertable to Boolean.Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.
-
Illegal Operation wrote:
Use
Checked
Property for that. Like :DBField
should the field of your database.It will resolve your issue.
Thanks !
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.Sorry, I didn't see your post before replying, so replied similar answer. :)
Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.
-
Sorry, I didn't see your post before replying, so replied similar answer. :)
Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.
:)
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
Hi! How can I create a ItemTemplate Checkbox that that gets the data from a database and display only the checkboxes and not the TRUE or FALSE text. The Code I currently have looks like this:
If I change the "Text" to "Checked" I get a Cast error. Can anyone please help?
Illegal Operation
Have you tried like this :
<asp:templatefield headertext="Author Name">
<itemtemplate>
<asp:Checkbox id="chkLunch" runat="server" Text= '<%# Eval("IsLunch") %>' />
</itemtemplate>Means have you placed in the
ItemTemplate
ofasp:templatefield
?Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Sorry, I didn't see your post before replying, so replied similar answer. :)
Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.
-
Try this:
<asp:CheckBox ID="chkLunch" runat="server" Checked='<%# Convert.ToBoolean(Eval("IsLunch")) %>' />
This should work provided IsLaunch should return value that is convertable to Boolean.Anurag Gandhi. http://www.gandhisoft.com Life is a computer program and every one is the programmer of his own life.
Thank you very much!! Your answer solved my problem.
Illegal Operation