Bonjour ,

voila je laisse la possibilité à l user de rentrer myOrder dans un textfield.
Je récupère le contenu après un clic bouton. (cette action definie dans <script> tag)
Le même bouton l envoie vers une URL précise, mais j arrive rien a faire pour concatener.
De 1 , je ne sais pas comment on récupe cette valeur urlBlabla+<%=myOrder%> (ne marche pas)
De 2, comment concatener ?

Voici mon code, avec les parties que je cite en GRAS
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
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    public string myOrder;
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        myOrder = Label1.Text.ToString();
        
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>All Orders</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <p>
        <asp:HyperLink ID="HyperLink2" runat="server" NavigateUrl="~/index.aspx">Home</asp:HyperLink>
    </p>
    </div>
    <asp:GridView align="center" ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="IDOrder" DataSourceID="SqlDataSource1" 
        EmptyDataText="There are no data records to display." AllowPaging="True">
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowSelectButton="True" />
            <asp:BoundField DataField="IDOrder" HeaderText="IDOrder" ReadOnly="True" 
                SortExpression="IDOrder" />
            <asp:BoundField DataField="IDCustomer" HeaderText="IDCustomer" 
                SortExpression="IDCustomer" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" 
        DeleteCommand="DELETE FROM [orders] WHERE [IDOrder] = ?" 
        InsertCommand="INSERT INTO [orders] ([IDOrder], [IDCustomer]) VALUES (?, ?)" 
        ProviderName="<%$ ConnectionStrings:ConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [IDOrder], [IDCustomer] FROM [orders]" 
        UpdateCommand="UPDATE [orders] SET [IDCustomer] = ? WHERE [IDOrder] = ?">
        <DeleteParameters>
            <asp:Parameter Name="IDOrder" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="IDOrder" Type="Int32" />
            <asp:Parameter Name="IDCustomer" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="IDCustomer" Type="Int32" />
            <asp:Parameter Name="IDOrder" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <p>
        <asp:Label ID="Label1" runat="server" 
            Text="Retrieve information about Order N°(enter the IDOrder) "></asp:Label>
&nbsp;</p>
    <p>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </p>
    <p>
        <asp:Button ID="Button1" runat="server" Text="OK" 
             PostBackUrl="~/displayOrder.aspx?id="+<%myOrder%> onclick="Button1_Click" />
    </p> //ne marche pas évidemment !
    <p>
        &nbsp;</p>
    <p>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/index.aspx">Home</asp:HyperLink>
    </p>
    </form>
</body>
</html>
Merci de votre solidarité envers les débutants ....