bonjour,
je souhaite récupérer le contenu de certains contrôles ASP dans du code javascript; je n'arrive pas à trouver la syntaxe ! avez-vous une idée ?
merci

voici un exemple de mon code : dans ma fonction javascript OnOkScript(obj), je souhaiterai récupérer le contenu du contôle FilePath

Merci

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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="main.aspx.vb" Inherits="ag_docassoc.main" Culture="fr-FR" UICulture="fr" %>

<%@ Register Assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.DynamicData" TagPrefix="cc1"  %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="act" %>

<!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 id="Head1" runat="server">
    <title>agdocassoc</title>
       
    <script language="javascript" type="text/javascript" >
        function OnOkScript(obj) 
        {
         document.form1['txt_publicon'].value = "true"
	 var test = document.DetailsViewAdd.FilePath.value;
        }
        function OnCancelScript() 
        {
        }   
    </script>

</head>
<body >

<!-- #include virtual="header.inc" -->

<form id="form1" runat="server" >

    <asp:ScriptManager ID="Scriptmanager1" runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" />

    <table width="100%" >
    <tr>
    <td valign="top">
    <asp: DetailsView ID="DetailsView1" runat="server"...>
         <Fields>....</Fields>
         </asp:DetailsView>
         <asp:SqlDataSource ID="OraDataSource2" runat="server" >
         </asp:SqlDataSource>
    </td>
    </tr>  
    
    <tr>
    <td>    
        <asp:DetailsView 
            ID="DetailsViewAdd" 
            runat="server"
            DataSourceID="OraDataSource3">
            <Fields>
                <asp:TemplateField  HeaderText="Description" > 
                    <ItemTemplate><asp:TextBox ID="DESCRIPTION" runat="server" Visible="true" /></ItemTemplate>             
                </asp:TemplateField>     

                <asp:TemplateField  HeaderText="Choisir une date" > 
                    <ItemTemplate>
                        <asp:TextBox ID="txt_caldate" runat="server"></asp:TextBox>
                        <act:CalendarExtender   ID="CalendarExtender1" runat="server" TargetControlID="txt_caldate" Format="dd/MM/yyyy" />  
                    </ItemTemplate>             
                </asp:TemplateField>
                
                <asp:TemplateField  HeaderText="Choisir un fichier" > 
                    <ItemTemplate>
                        <asp:FileUpload ID="FilePath" runat="server" Visible="true" /><asp:Button iD="bt_fichier" runat="server" Text="Publier?" OnClientClick="test()" /> 
                    </ItemTemplate>                                    
                </asp:TemplateField>
                                               
                <asp:TemplateField  HeaderText=""  >  
                    <ItemTemplate>

                    <div id="pageContent">
                    <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display:none" >
                        <div style="margin:10px" >
                        Voulez-vous publier le fichier ?<br /><br />
                        <asp:Button ID="Button1" runat="server" Text="Oui" width="40px"   />
                        <asp:Button ID="Button2" runat="server" Text="Non"  width="40px"  />
                        </div>
                    </asp:Panel>
                    </div>
                    <act:ModalPopupExtender ID="ModalPopupExtender1" runat="server"   
                            OnOkScript="javascript:OnOkScript(this)" 
                            OnCancelScript="javascript:OnCancelScript()"
                            TargetControlID="id_ok"
                            OkControlID="Button1"
                            CancelControlID="Button2" />  
                    <asp:Button ID="id_ok"     Text="OK"      runat="server"  />
                    <asp:Button ID="id_cancel" Text="Annuler" runat="server" CommandName="Annuler" />
            
                    </ItemTemplate>                           
                </asp:TemplateField>
                
                <asp:ButtonField ButtonType="Link"     Text="Ajouter"  CommandName="Ajouter" />
                <asp:ButtonField ButtonType="Link"     Text="Annuler"  CommandName="Annuler" />                 
            </Fields>

            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:DetailsView>              

        <asp:SqlDataSource ID="OraDataSource3" runat="server"  
          ConnectionString="<%$ ConnectionStrings:agconnectstr %>" 
          ProviderName="<%$ ConnectionStrings:agconnectstr.ProviderName %>"
          InsertCommand="UPDATE ORA_URBA.DOC_ASSOCIE SET IDDOC=0 WHERE IDDOC=0" >
        </asp:SqlDataSource>
        
    </td>
    </tr>

    <tr><td<
    </td></tr>

    </table>
    <br />
    <hr />
    
    <asp:TextBox ID="txt_publicon" Visible="true" runat="server" Text="OUI" CausesValidation="true" Wrap="false"  /> 

</form>
<!-- #include virtual="footer.inc" -->   
   
</body>
</html>