?
Solved

Gridview ItemTemplate with If condition of Database Data

Posted on 2008-10-21
6
Medium Priority
?
7,385 Views
Last Modified: 2012-05-05
Dear Experts
In Gridview I would like to use check Box If condtion is true other wise Label with Text

    <ItemTemplate>
                  <%# (If (Eval("submitCd"))=0 Then) %>
                    <asp:CheckBox ID="chkStatus" runat="server" />
                    <%# else %>
                    <asp:Label ID="lblStatus" runat="server" Text="Submitted" />
                      <%#end if) %>
                  </ItemTemplate>

SubmitCd is a database field, when user submit his Timesheet the value is updated as 1, so on when Approver Approve SubmitCd value updated to 3, accordingly I would like change the LblStatus Text.

If he did not submit, there should be  checkbox, by which user can checked and click submit button to submit.

I already this in ASP but dont know how to do in ASP.Net.

Regards
0
Comment
Question by:samijsr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 18

Accepted Solution

by:
David Robitaille earned 375 total points
ID: 22767655
you should toggle the Visible property instead

<asp:CheckBox ID="chkStatus" runat="server" visible='<%# (Eval("submitCd")=0) %>'/>
 

Open in new window

0
 
LVL 4

Author Closing Comment

by:samijsr
ID: 31508277
Thanks buddy
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 22786242
Could i know, why does it get a "B", if it resolve the issue, I think I should get a "A".
Please read this:
http://www.experts-exchange.com/help.jsp#hi403
abstract: "an answer is worth an A, unless it doesn't resolve your issue"
 
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Author Comment

by:samijsr
ID: 22786461
Dear Friend,
I rate this as "B" cause it is not he exact solution I am looking for.
This code is helpful for single if condition, but actually me requirement is for nested If as I did in ASP.

Might be Grid view doesn,t flexible enogh to handle nested If condition, I am not sure.

Regards

Sami

0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 22786588

it`s beacues ASP.net woks differently than classic ASP.
the <%#  %> dont works like in asp. And no, it dosent work for nested If.
I provided only one side of the if because the other side is trivial.
you could do nested if in the "databinded" event of the of the gridview row to achive the same goal.
Next time, if the answer dose not fulfill your need, please seen some feedback so experts could provide an more complete answer. Also, if you grade lower than "A", please provide some "Grading comments" that explain why.
It s not because I`m angry, I just want to know so I will be better next time...
0
 
LVL 4

Author Comment

by:samijsr
ID: 22786980
Thanks dear,

I will do same.

Regards
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question