Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 26, 2012 11:08 AM by talluri
Member
39 Points
59 Posts
Mar 26, 2012 09:03 AM|LINK
gridColumns.Add(new GridColumnInfo { ColumnHeader = "Status", ColumnName = "Status" });
hi from the above column i get either "1" or "0"
now ifi get 1 - i should show true
else false
how can i format thatin that line......
Participant
986 Points
247 Posts
Mar 26, 2012 09:11 AM|LINK
In the row databound event you can check if the value is 1 or something else and accordingly you can set the text.
Mar 26, 2012 09:12 AM|LINK
can u give any example.....
Mar 26, 2012 09:21 AM|LINK
GridViewRow row = e.Row; if (row.RowType == DataControlRowType.DataRow) { string id = ((Label)row.FindControl("Labelid")).Text;
if(id=="1")
((Label)row.FindControl("Labelid1")).Text="True";
else
((Label)row.FindControl("Labelid1")).Text=False;
}
Mar 26, 2012 09:29 AM|LINK
but im using the gridview in controller....as
IList<GridColumnInfo> gridColumns = new List<GridColumnInfo>();
how can use rowdatabound here............
Mar 26, 2012 11:08 AM|LINK
done it in backend only....
talluri
Member
39 Points
59 Posts
Using if contion in Grid Column ???
Mar 26, 2012 09:03 AM|LINK
gridColumns.Add(new GridColumnInfo { ColumnHeader = "Status", ColumnName = "Status" });hi from the above column i get either "1" or "0"
now ifi get 1 - i should show true
else false
how can i format thatin that line......
dinesh kumar...
Participant
986 Points
247 Posts
Re: Using if contion in Grid Column ???
Mar 26, 2012 09:11 AM|LINK
In the row databound event you can check if the value is 1 or something else and accordingly you can set the text.
Jai Jagannath
talluri
Member
39 Points
59 Posts
Re: Using if contion in Grid Column ???
Mar 26, 2012 09:12 AM|LINK
can u give any example.....
dinesh kumar...
Participant
986 Points
247 Posts
Re: Using if contion in Grid Column ???
Mar 26, 2012 09:21 AM|LINK
GridViewRow row = e.Row;
if (row.RowType == DataControlRowType.DataRow)
{
string id = ((Label)row.FindControl("Labelid")).Text;
if(id=="1")
((Label)row.FindControl("Labelid1")).Text="True";
else
((Label)row.FindControl("Labelid1")).Text=False;
}
Jai Jagannath
talluri
Member
39 Points
59 Posts
Re: Using if contion in Grid Column ???
Mar 26, 2012 09:29 AM|LINK
but im using the gridview in controller....as
IList<GridColumnInfo> gridColumns = new List<GridColumnInfo>();
gridColumns.Add(new GridColumnInfo { ColumnHeader = "Status", ColumnName = "Status" });
how can use rowdatabound here............
talluri
Member
39 Points
59 Posts
Re: Using if contion in Grid Column ???
Mar 26, 2012 11:08 AM|LINK
done it in backend only....