Link to home
Start Free TrialLog in
Avatar of JCWEBHOST
JCWEBHOST

asked on

Bind visible control in gridview

hey guys i need to set a control in a gridview visible  to true or false if the text is Yes or No

if binding value is Yes the the visible must be true
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Code behind is best for this.  I'm a VB person so this might not be EXACTLY right :0)

    protected void myGvRowDataBound(object sender, GridViewRowEventArgs e) {
        switch (e.Row.RowType) {
            case DataControlRowType.DataRow:
                Label myControl = e.row.findcontrol("myControlIDHere");
                if (Convert.ToBoolean(e.row.dataitem("myDataBaseColumn"))) {
                    myControl.Visible = false;
                }
                break;
        }
    }

Open in new window

Avatar of JCWEBHOST
JCWEBHOST

ASKER

i am looking for something like this

<%# ConvertBoolToYesNo(Eval("YOUR_FIELD"))%>
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial