Bonjour,

J'essai d'alimenter un gridview à partir d'une requete Oracle.

Je rencontre actuellement le message :
Le nom 'GRIDVIEW_CHOIX_APPS' n'existe pas dans le contexte actuel
Auriez vous une idée pour me dépanner ?

Merdi d'avance

Ci dessous le code :
ASPX
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="PageDynApp.aspx.cs" Inherits="_Default" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        #Table7
        {
            width: 442px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div id="divResult"></div>
<div runat="server">
    <asp:Panel runat="server" CssClass="PanelInfo">
        <table id="Table7" class="Info">
            <tr class="ListRow">
            <td class="CellValue"><span class="Label">
                <asp:GridView ID="GRIDVIEW_CHOIX_APPS" runat="server" 
                    AutoGenerateColumns="False" CssClass="GridView" ToolTip="Applications"  
                    ShowFooter="False" Width="425px">
                    <Columns>
 
                        <asp:TemplateField HeaderText="Applications">
                            <EditItemTemplate>
                                <asp:Label ID="GRIDVIEW_CHOIX_APPS_APP" runat="server" Width="400px"></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                            <asp:Label ID="GRIDVIEW_CHOIX_APPS_APP" runat="server" ></asp:Label>
                            </ItemTemplate>
                            <HeaderStyle CssClass="Label" HorizontalAlign="Center" />
                            <FooterStyle HorizontalAlign="Right" />
                            <ItemStyle HorizontalAlign="Right" Width="65px" />
                            <ControlStyle CssClass="Value" />
                        </asp:TemplateField>
                    </Columns>
                    <HeaderStyle CssClass="Header" />
                    <RowStyle CssClass="Row" />
                    <AlternatingRowStyle CssClass="AlternatingRow" />
                </asp:GridView>
               </span>
            </td>
            </tr>
 
            </table>
 
        </asp:Panel>
        <br />
    </div>
 
 
 
 
 
 
 
 
 
 
    <!--
    &nbsp;<span ><asp:Button ID="ButtonOK" runat="server" Text="OK" Height="21px" 
        Width="31px"/>
        <br />
        <asp:TextBox ID="TEXTBOX_UTIL" runat="server" Visible="False"></asp:TextBox>
         <asp:TextBox ID="TEXTBOX1" runat="server" Visible="False"></asp:TextBox>
          <asp:TextBox ID="TEXTBOX2" runat="server" Visible="False"></asp:TextBox>
        </span>
    -->
   <!-- HIDDEN FIELDS AND DATA SOURCES -->
    <asp:Panel ID="HiddenFields" runat="server">
        <asp:SqlDataSource ID="SqlDataApp" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MyDataBase %>" 
            ProviderName="<%$ ConnectionStrings:MyDataBase.ProviderName %>" 
            SelectCommand="SELECT ' ' as NUM_ECRAN, ' ' as LIB FROM DUAL UNION select TO_CHAR(c.id_combo_value) as NUM_ECRAN, des_oa as LIB from objetapp_usr, objetapp, oa_carac, csd_profile_templ_ticket_type c, password p where objetapp_usr.code_oa = objetapp.code_oa and oa_carac.code_oa = objetapp_usr.code_oa and objetapp_usr.code_usr = p.code_usr and p.csdp_code = c.id_profile and val_car1 = id_temp_form and code_cw = '0000000005' and objetapp_usr.code_usr = :code_util">
            <SelectParameters>
                <asp:ControlParameter Name="code_util" ControlID="TEXTBOX_UTIL" PropertyName="Text"/>
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataPopGridApps" runat="server" 
            ConnectionString="<%$ ConnectionStrings:MyDataBase %>"
            ProviderName="<%$ ConnectionStrings:MyDataBase.ProviderName %>">
        </asp:SqlDataSource>
 
    </asp:Panel>
    </form>
</body>
</html>
C#
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 
using System;
using System.Data;
using System.IO;
using System.Configuration;
using System.Globalization;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using Oracle.DataAccess.Client;
using System.Data.Common;
 
public partial class _Default : System.Web.UI.Page 
{
    //String appc_code;
    String url;
    String window_open;
    String usercode;
    String login;
    String password;
 
    //String string_connexion = "Data Source=AGILP;User Id=PSSOFT;Password=PSSAGILP1020;";
 
    protected void Page_Load(object sender, EventArgs e)
    {
        usercode = Request.Params["code_usr"];
        login = Request.Params["login"];
        password = Request.Params["password"];
 
        TEXTBOX_UTIL.Text = usercode;
 
        //appc_code = this.VISA_CHOIX_APP.SelectedValue;
 
        /*String selreq1 = "select TO_CHAR(c.id_combo_value) as NUM_ECRAN, des_oa as LIB ";
        String fromsel1 = "from objetapp_usr, objetapp, oa_carac, csd_profile_templ_ticket_type c, password p ";
        String wheresel1 = "where objetapp_usr.code_oa = objetapp.code_oa and oa_carac.code_oa = objetapp_usr.code_oa ";
        String wheresel2 = "and objetapp_usr.code_usr = p.code_usr and p.csdp_code = c.id_profile and val_car1 = id_temp_form and code_cw = '0000000005' and objetapp_usr.code_usr = '" + this.TEXTBOX_UTIL.Text + "' ";
        String sqlcom = selreq1 + fromsel1 + wheresel1 + wheresel2;
        string strSQLconnection = "Data Source=AGILP;User Id=PSSOFT;Password=PSSAGILP1020;";
        OracleConnection OConnexion = new OracleConnection();
        OConnexion.ConnectionString = strSQLconnection;
        // Ouverture de la connexion
        OConnexion.Open();
        OracleCommand cmd = new OracleCommand(sqlcom);
        cmd.Connection = OConnexion;
        OracleDataReader reader = cmd.ExecuteReader();
        GRIDVIEW_CHOIX_APPS.DataBind();*/
 
        //TEXTBOX2.Text = appc_code;
 
        //this.VISA_CHOIX_APP.AutoPostBack = true;
 
        //url = "/pssoft/itam/redir.aspx?target=ServiceManagementIncidentIncidentForm&EXTERNALINCIDENT=TRUE&code_usr=" + usercode + "&login=" + login + "&password=" + password + "&MODE=CREATEINCIDENTBYTYPE&AUTOFILLUSER=0&AUTOFILLCALLER=1&TICKETTYPE=" + appc_code;
 
        window_open = "window.open('" + url + "')";
 
        this.ButtonOK.Attributes.Add("onclick", window_open);
 
        String selreq1 = "select TO_CHAR(c.id_combo_value) as NUM_ECRAN, des_oa as LIB ";
        String fromsel1 = "from objetapp_usr, objetapp, oa_carac, csd_profile_templ_ticket_type c, password p ";
        String wheresel1 = "where objetapp_usr.code_oa = objetapp.code_oa and oa_carac.code_oa = objetapp_usr.code_oa ";
        String wheresel2 = "and objetapp_usr.code_usr = p.code_usr and p.csdp_code = c.id_profile and val_car1 = id_temp_form and code_cw = '0000000005' and objetapp_usr.code_usr = '" + this.TEXTBOX_UTIL.Text + "' ";
        String sqlcom = selreq1 + fromsel1 + wheresel1 + wheresel2;
 
        string strSQLconnection = "Data Source=AGILP;User Id=PSSOFT;Password=PSSAGILP1020;";
 
        OracleConnection OConnexion = new OracleConnection();
        OConnexion.ConnectionString = strSQLconnection;
        // Ouverture de la connexion
        OConnexion.Open();
        OracleCommand cmd = new OracleCommand(sqlcom);
        cmd.Connection = OConnexion;
        OracleDataReader reader = cmd.ExecuteReader();
 
        /*while (reader.Read())
        {
            this.SEL_COMPETENCES_COLL_SEL.Text = reader.GetString(0);
            this.VG_NOM_COLL.Text = reader.GetString(0);
        }*/
 
 
        GRIDVIEW_CHOIX_APPS.DataSource = reader;
 
        GRIDVIEW_CHOIX_APPS.DataBind();
 
        OConnexion.Close();
 
    }
}