The image above is the part of the GridView bound to the background database. The fourth column shows the gender column. The data type in the background database is boolean. The values are true or false. If the value is true, the data type is male. If the value is false, the data type is female...
What we are talking about today is to display the Gender column on the browser page as men and women rather than true and false when reading gender from the background database.
Many people have said that it is not okay to directly write in the query statement. Yes, this method is feasible.
Today, I will use the RowDataBound bound to the GridView to implement it...
At the front-end of the page, I will not write more (roughly the same). I will only write the Gender column as an example:
<Asp: BoundField DataField = HeaderText = ItemStyle-HorizontalAlign => <ItemStyle HorizontalAlign = Height => </ItemStyle> </asp: BoundField>
This is a prerequisite for Data Binding. Note the attributes DataField and SortExpression. If not, you cannot bind background data to the page even if you have written a query statement.
After preparing the front-end page, the RowDataBound event that triggers the GridView is as follows:
GridView_RowDataBound (e. row. rowType = (e. row. cells []. text =]. text = (e. row. cells []. text. toString () =]. text =
I believe you can understand this code. If you don't talk about it much, you can see that gender is listed as male and female...
There is no technical content, and it is not any innovative code. The post is just for you to understand the usage of this gridView_RowDataBound event.
For reference only !!!