Bonjour à tous,
dans un gridview j'ai une colonne qui reprendre une donnée numérique.
Comment puis-je convertir cette donnée en string comme si j'utilisais un switch ?
Càd que si la valeur vaut 0, je retourne "A", 1 = "B" et ainsi de suite
Le gridview est alimenté via un SQLDataSource
Code actuel :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41 <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WUC_LstCourse.ascx.cs" Inherits="wRacingTeam.WUC_LstCourse" %> <br /> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="CoNom" HeaderText="Nom" SortExpression="CoNom" /> <asp:BoundField DataField="CoCommentaire" HeaderText="Info" SortExpression="CoCommentaire" /> <asp:TemplateField HeaderText="Type" SortExpression="CoType"> <EditItemTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("CoType") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("CoType") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="CoDate" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Date" SortExpression="CoDate" /> <asp:BoundField DataField="CoHeureDebut" DataFormatString="{0:t}" HeaderText="Début à" SortExpression="CoHeureDebut" /> <asp:BoundField DataField="CoHeureFin" HeaderText="Fin à" SortExpression="CoHeureFin" /> <asp:BoundField DataField="EvNom" HeaderText="Evénement" SortExpression="EvNom" /> </Columns> <FooterStyle BackColor="White" ForeColor="#000066" /> <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" /> <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" /> <RowStyle ForeColor="#000066" /> <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" /> <SortedAscendingCellStyle BackColor="#F1F1F1" /> <SortedAscendingHeaderStyle BackColor="#007DBB" /> <SortedDescendingCellStyle BackColor="#CAC9C9" /> <SortedDescendingHeaderStyle BackColor="#00547E" /> </asp:GridView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:csSQL %>" SelectCommand="SELECT Course.CoNom, Course.CoCommentaire, Course.CoType, Course.CoHeureDebut, Course.CoDate, Course.CoHeureFin, Course.CoCodeEv, Evenement.EvNom FROM Course INNER JOIN Evenement ON Course.CoCodeEv = Evenement.EvCode"> </asp:SqlDataSource>
Merci bcp
Partager