home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 9,328 of 10,840   
   Corey to Cor Ligthert   
   Re: Asp.net DropDownList, AutoPostBack,    
   19 Mar 05 17:41:54   
   
   XPost: microsoft.public.dotnet.framework.aspnet, microsoft.publi   
   .dotnet.framework.aspnet.webservices, microsoft.public.dotnet.languages.vb   
   XPost: microsoft.public.inetserver.asp.general   
   From: shadowcaster@rogers.com   
      
   Any time i try to change the DropDownList I get a javascript error which   
   says "Error: 'WebForm_PostBackOptions' is undefined"   
   How can I restore this?   
      
   VB Code is as follows.   
      
      
   Private Sub Page_Load(ByVal sender As System.Object, ByVal e As   
   System.EventArgs) Handles MyBase.Load   
      
   'Put user code to initialize the page here   
      
   If Not IsPostBack Then   
      
   SqlDAUsers.Fill(DsUsers1)   
      
   DropDownList1.DataBind()   
      
   ' DataGrid1.DataBind()   
      
   ' dvUsers1.RowFilter = "Userkey = " & Me.ViewState("DropDownList1") '&   
   DsUsers1.Users.UserKeyColumn.ToString()   
      
   txtFirstName.DataBind()   
      
   txtLastName.DataBind()   
      
   SqlDARulesLookup.SelectCommand.Parameters.Item(1).Value =   
   DropDownList1.SelectedItem.Value   
      
   SqlDARulesLookup.Fill(DsRulesLookup1)   
      
   DataGrid2.DataBind()   
      
   End If   
      
   ' Response.Write("Selected - " + DropDownList1.SelectedItem.Value)   
      
   ' Response.Write("Uber Select - " & DropDownList1.SelectedIndex)   
      
   End Sub   
      
   Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As   
   System.Object, ByVal e As System.EventArgs) Handles   
   DropDownList1.SelectedIndexChanged   
      
      
      
   ' txtFirstName.Text = DsUsers1.Users.FirstNameColumn.ToString   
      
   ' txtLastName.Text = DsUsers1.Users.LastNameColumn.ToString   
      
   dvUsers1.RowFilter = "Userkey = " & DsUsers1.Users.UserKeyColumn.ToString()   
      
   txtFirstName.DataBind()   
      
   txtLastName.DataBind()   
      
   Response.Write("SelectedIndex!")   
      
   End Sub   
      
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As   
   System.EventArgs) Handles Button1.Click   
      
   Dim strSQLQuery As String   
      
   strSQLQuery = "UPDATE Users " _   
      
   & "SET FirstName = '" & Replace(txtFirstName.Text, "'", "''") & "', " _   
      
   & "LastName = '" & Replace(txtLastName.Text, "'", "''") & "' " _   
      
   & "WHERE UserKey = " & DropDownList1.SelectedItem.Value & ";"   
      
   'Response.Write(strSQLQuery)   
      
   SqlSaveCommand.CommandText = strSQLQuery   
      
   SqlUsers.Open()   
      
   SqlSaveCommand.ExecuteNonQuery()   
      
   SqlUsers.Close()   
      
   'update datasets?   
      
   End Sub   
      
   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As   
   System.EventArgs) Handles Button2.Click   
      
   ' Define Crystal Reports variables   
      
   Dim crReportDocument As ReportDocument   
      
   Dim crExportOptions As ExportOptions   
      
   Dim crDiskFileDestinationOptions As DiskFileDestinationOptions   
      
   Dim Fname As String   
      
   ' The following code can be placed directly after the call to   
      
   ' InitializeComponent() in the form's constructor, or inside of   
      
   ' a Button_Click event where the button is used by the client to   
      
   ' get a printable copy of the report.   
      
   crReportDocument = New ReportDocument()   
      
   ' The following line of code loads the sample report "Chart.rpt" that   
   installs   
      
   ' with Visual Studio .NET   
      
   crReportDocument.Load("C:\Inetpub\wwwroot\WebApplication3\CrystalReport2.rpt")   
      
   Fname = "C:\inetpub\wwwroot\WebApplication3\" & Session.SessionID.ToString &   
   ".pdf"   
      
   crDiskFileDestinationOptions = New DiskFileDestinationOptions()   
      
   crDiskFileDestinationOptions.DiskFileName = Fname   
      
   crExportOptions = crReportDocument.ExportOptions   
      
   With crExportOptions   
      
   .DestinationOptions = crDiskFileDestinationOptions   
      
   .ExportDestinationType = ExportDestinationType.DiskFile   
      
   .ExportFormatType = ExportFormatType.PortableDocFormat   
      
   End With   
      
   crReportDocument.Refresh()   
      
   crReportDocument.Export()   
      
   ' The following code writes the pdf file to the Client's browser.   
      
   Response.ClearContent()   
      
   Response.ClearHeaders()   
      
   Response.ContentType = "application/pdf"   
      
   Response.WriteFile(Fname)   
      
   Response.Flush()   
      
   Response.Close()   
      
   'delete the exported file from disk   
      
   System.IO.File.Delete(Fname)   
      
   End Sub   
      
   End Class   
      
      
   "Cor Ligthert"  wrote in message   
   news:OEpRyQ$KFHA.2860@TK2MSFTNGP10.phx.gbl...   
   > Corey,   
   >   
   > This is the mainly RAD created part of your code.   
   > I don't know if you have any VBcode so called code behind.   
   >   
   > The problem with this is that I cannot simulate what you did, because it   
   > depends on your evironment that you draged on your form.   
   >   
   > However there must be as well a part wherin is that event from the   
   > dropdownlist.   
   >   
   > Cor   
   >   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca