换掉它是什么意思?__doPostBack()方法是asp.net回发当前页的客户端代码,好多服务器控件,象LinkButton等都必须有这个方法才能正确工作。

解决方案 »

  1.   

    <script language="VB" runat="server">
      Sub CreateFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim strFileName As String = funcParam.Value
        'custom code to create a text file
      End Sub
    </script>
    <html>
    <head>
    <script language="JavaScript">
      //ask for user input and then create file
      function CreateFile() {
        //get filename from the user
        var fileName = prompt('Type the name of the file you want to create:','');
        //if the user clicks on OK and if they have entered something
        if ((fileName) && (fileName!="")) {
          //save the filename to the hidden form field 'funcParam'
          document.forms['myForm'].elements['funcParam'].value = fileName;
          //call the postback function with the right ID
          __doPostBack('CreateFile','');
        }
      }
    </script>
    </head>
     
    <body>
    <form runat="server" id="myForm">
      <a href="javascript:CreateFile();">Create Text file</a>
      <asp:linkbutton id="CreateFile" runat="server" onclick="CreateFile_Click" />
      <input type="hidden" runat="server" id="funcParam">
    </form>
    </body>
    </html>