Process Bar With Process Completion Messages - asp.net

I am Executing Multiple store procedures on Button click event of my .aspx page
On each Procedure Execution i have to show a message on Process baar that
process 1 is completed.
process 2 is completed.
process 3 is completed.
please help in this

One way is to use an Update Panel in conjunction with Ajax Timer.
The following article may be useful.
http://msdn.microsoft.com/en-in/library/cc295400.aspx
The example given in the article shows you how to update a label in the Update Panel with current server time on the timer event. You can easily adapt the code to your needs and show whatever message you want to show instead of server time.
EDIT
As requested here is some sample code.
Add a new aspx file to your application and name it Test2.aspx
Replace the contents of aspx file as given below.
Run the application and see the sample code working.
Customize the DoWorkAsync method to suit your needs.
Run application and test your modified code.
The ASPX file:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Test2.aspx.vb" Inherits="Test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Asynchronous Update Demo</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="ScriptManager1">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
<ContentTemplate>
<asp:Timer runat="server" ID="Timer1" Interval="1000" />
<asp:Button ID="Button1" runat="server" Text="Start" /><br />
<asp:Label runat="server" Text="Click Start button to being processing." ID="Label1" />
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
Code behind file:
(pay attention to inline comments)
Partial Class Test2
Inherits System.Web.UI.Page
Private MyAsyncProcessor As AsyncProcessor
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("MyAsyncProcessor") IsNot Nothing Then
' we are still processing.. so extract the reference of our class back from session variable
Me.MyAsyncProcessor = Session("MyAsyncProcessor")
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' this event is fired everytime a timer ticks.
If MyAsyncProcessor IsNot Nothing Then
Label1.Text = MyAsyncProcessor.StatusMessage
If Not MyAsyncProcessor.IsProcessing Then
MyAsyncProcessor = Nothing
Session.Remove("MyAsyncProcessor")
Timer1.Enabled = False
End If
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = ""
Button1.Enabled = False
Timer1.Enabled = True
MyAsyncProcessor = New AsyncProcessor
MyAsyncProcessor.Start()
Session("MyAsyncProcessor") = MyAsyncProcessor 'save reference in a session variable
End Sub
End Class
Public Class AsyncProcessor
Public IsProcessing As Boolean
Public StatusMessage As String
Public Sub Start()
Dim th As New Threading.Thread(AddressOf DoWorkAsync)
th.Start()
End Sub
Private Sub DoWorkAsync()
' *** Replace this code with whatever work you want to do ***
' Set IsProcessing=True at beginnning of task and set it to False when exitting.
' Update the StatusMessage at regular intervals.
IsProcessing = True
For i = 1 To 10
'' this sleep is only to simulate a long going task
Threading.Thread.Sleep(1000)
StatusMessage &= String.Format("Task #{0} completed... <br>", i)
Next
StatusMessage &= "All tasks completed."
IsProcessing = False
End Sub
End Class

Another way is to delegate the work to a page in an iframe. On the iframe page, as your code is processed, you can update a Session variable to contain 'Finished Processing first step' (or whatever) and use PageMethods on the parent page to call a Web Method that gets the value of the session being updated by the code on the page in the iframe.

Related

Dynamically Add Text Files to DDL in ASP & VB

I am looking to update one of my DDL's functionality by making it dynamically update so if the user adds more files, the drop down will pick this up.
At present my drop down list is pulling from VB code behind, as shown below:
Public Sub DDL_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ddl As DropDownList = CType(sender, DropDownList) 'item is already dropdownlist
Dim ctl As TextBox = DirectCast(ddl.NamingContainer.FindControl("eTemplate"), TextBox)
If ddl.SelectedValue = 1 Then
ctl.Text = File.ReadAllText("e:Documents\Visual Studio 2013\Projects\Web\Templates\Down.txt")
ElseIf ddl.SelectedValue = 2 Then
ctl.Text = File.ReadAllText("e:Documents\Visual Studio 2013\Projects\Web\Templates\Up.txt")
Else
ctl.Text = ""
End If
End Sub
At the moment I have hard coded in the functionality for the VB to grab specific .txt files, how can I get this to update dynamically from a folder of .txt files?
Thanks for looking.
Here is some sample code for you. This demo uses an UpdatePanel and a Timer to refresh the DropdownList every 5 seconds.
Add a new aspx file to your Web Application and the following code:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Demo.aspx.vb" Inherits="Zpk_Test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Asynchronous Update Demo</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager runat="server" ID="ScriptManager1" />
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" /><br />
<asp:Timer runat="server" ID="Timer1" Interval="5000" Enabled="true" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="DropDownList1" />
</Triggers>
</asp:UpdatePanel>
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" Width="300" Height="250" />
</form>
</body>
</html>
This is the code-behind:
Partial Class Demo
Inherits System.Web.UI.Page
Private Const FolderName As String = "C:\Temp" '<-- replace with your folder name
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
RefreshDropDownList()
OpenSelectedFile()
End If
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' this event is fired everytime a timer ticks.
' refresh your dropdown list here.
RefreshDropDownList()
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
OpenSelectedFile()
End Sub
Private Sub RefreshDropDownList()
Dim currentSelected As String = DropDownList1.SelectedValue
DropDownList1.DataSource = IO.Directory.GetFiles(FolderName, "*.txt").Select(Function(f) IO.Path.GetFileName(f)).ToList
DropDownList1.DataBind()
DropDownList1.SelectedValue = currentSelected
End Sub
Private Sub OpenSelectedFile()
Dim fileName As String = IO.Path.Combine(FolderName, DropDownList1.SelectedValue)
TextBox1.Text = IO.File.ReadAllText(fileName)
End Sub
End Class

VB ASP.NET 4.0 - Adding Example to new web project

I'm trying to learn ASP.NET (after many years of using classic ASP, jQuery, Ajax etc). I've installed VS 2010 and have IIS running on my W7 64bit PC.
I've created a new web project (in a folder called C:\ASP.NET Testing\ASP.NET 4.0 Examples) called ASP.NET-4.0.
I can compile the project fine and run the default page etc.
I am trying to load in a simple example from a book (ASP.NET 4.0 In Practice). So, I've created a sub folder CH01, and then copied in the .aspx and .aspx.vb files.
When I debug this, I get
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'ASP.NET_4._0.Global_asax'.
Source Error:
Line 1: <%# Application Codebehind="Global.asax.vb" Inherits="ASP.NET_4._0.Global_asax" Language="vb" %>
in the browser window.
The sample code (which has been downloaded from the website) is :
<%# Page Language="VB" AutoEventWireup="false" CodeFile="1-4.aspx.vb" Inherits="_1_4" %>
<html>
<head>
<title>Listing 1.4</title>
</head>
<body>
<form id="Form1" runat="server">
<div>
<asp:literal id="ResponseText" runat="server" />
<br />
Enter your name:
<asp:textbox runat="server" ID="Name" />
<br />
<asp:button runat="server" Text="Click Me" ID="ClickButton" OnClick="HandleSubmit" />
</div>
</form>
</body>
</html>
and
Partial Class _1_4
Inherits System.Web.UI.Page
Sub HandleSubmit(ByVal sender As Object, ByVal e As EventArgs)
ResponseText.Text = "Your name is: " & Name.Text
End Sub
End Class
In VS, I also get an error message highlighting the ResponseText.Text = "Your name is: " & Name.Text
'ResponseText' is not declared. It may be inaccessible due to its protection level.
Global.asxa file
Imports System.Web.SessionState
Public Class Global_asax
Inherits System.Web.HttpApplication
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application is started
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session is started
End Sub
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires at the beginning of each request
End Sub
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)
' Fires upon attempting to authenticate the use
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Fires when an error occurs
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
End Sub
End Class
I'm obviously missing something really simple, but I don't get it. I can't see any instructions as to anything which I need to set within VS.
Thanks.
This page works OK if I add from VS. In effect the same page as I'm copying in from the examples, but with slight changes to the page tag. It alos has a .designer.vb page which was automatically generated by VS.
14.aspx
<%# Page Language="vb" AutoEventWireup="false" CodeBehind="14.aspx.vb" Inherits="ASP.NET_4._0._14" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Listing 1.4</title>
</head>
<body>
<form id="Form1" runat="server">
<div>
<asp:literal id="ResponseText" runat="server" />
<br />
Enter your name:
<asp:textbox runat="server" ID="Name" />
<br />
<asp:button runat="server" Text="Click Me" ID="ClickButton" OnClick="HandleSubmit" />
</div>
</form>
</body>
</html>
14.aspx.vb
Public Class _14
Inherits System.Web.UI.Page
Sub HandleSubmit(ByVal sender As Object, ByVal e As EventArgs)
ResponseText.Text = "Your name is: " & Name.Text
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class
14.aspx.designer.vb
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Partial Public Class _14
'''<summary>
'''Form1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Form1 As Global.System.Web.UI.HtmlControls.HtmlForm
'''<summary>
'''ResponseText control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents ResponseText As Global.System.Web.UI.WebControls.Literal
'''<summary>
'''Name control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents Name As Global.System.Web.UI.WebControls.TextBox
'''<summary>
'''ClickButton control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents ClickButton As Global.System.Web.UI.WebControls.Button
End Class
Check you global.asax on the root of your website. There seems to be something wrong with the class name/namespace. I don't think it has anything to do with the file you added, but rather with something you probably moved or removed by mistake.

ASP.NET AJAX and Session Variables

I have an ASP.NET (VB.NET) application with 2 pages, a 'main' page and a second 'data-only' page whose only purpose is to be an AJAX data target for the main page, making a database call and rendering the results for a jQuery (AJAX) .get(). I'm using a session variable in the main page that I want to test for the existence of in the data-only page before it makes its DB call and renders the data.
I've tried doing this directly and it fails. From what I've been able to determine so far, the data-only page is unable to detect the session variable until its session is officially started (somehow using session_start, apparently). If this is correct, how do I start a session in the data-only page when it is only accessed via AJAX calls from the main page? I definitely need the data-only page to be session variable-aware. Thanks!
-- Rick
Both pages are ASP.NET. I added a label to the main page to validate (on page_load and on submit of the session value) that the session variable exists and what it is. The data_only page returns a yes or no message (it's always no) if it detects the presense of the session variable.
Page Code - main.aspx:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="main.aspx.vb" Inherits="main" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="txt_1" runat="server"></asp:TextBox>
<asp:Button ID="but_1" runat="server" Text="Add Session Variable" /><br />
<asp:Label ID="lbl_1" runat="server"></asp:Label><br /><br />
<asp:Button ID="but_2" runat="server" Text="Get Data" />
<asp:Label ID="lbl_2" runat="server"></asp:Label>
</form>
<script type="text/javascript">
$(document).ready(function () {
$('#but_2').on('click', function (event) {
event.preventDefault();
$.get("data_only.aspx", function (data) {
$('#lbl_2').text(data);
});
});
});
</script>
</body>
</html>
Code-Behind - main.aspx:
Partial Class main
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Call Check_Session()
End Sub
Protected Sub but_1_Click(sender As Object, e As System.EventArgs) Handles but_1.Click
Session("var1") = txt_1.Text
Call Check_Session()
End Sub
Private Sub Check_Session()
Dim strSession = Session("var1")
If strSession Is Nothing Then
lbl_1.Text = "No Session variable."
Else
lbl_1.Text = "Session Variable = " & strSession
End If
End Sub
End Class
Page Code - data_only.aspx:
<%# Page Language="VB" AutoEventWireup="false" CodeFile="data_only.aspx.vb" Inherits="data_only" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
</head>
<body></body>
</html>
Code-Behind - data_only.aspx:
Partial Class data_only
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim strSession = Session("var1")
If strSession Is Nothing Then
Response.Write("No session variable.")
Else
' Database call occurs here
Response.Write("Success! Get data here.")
End If
Response.End()
End Sub
End Class
Maybe you could try using a "master class" for both pages i.e both pages inherit from your master class (which in turn from Inherits System.Web.UI.Page) that has all the session handling logic.
Just to clarify and narrow the scope, all .aspx pages are session aware by default and I'm pretty sure that this is not your problem.
First of all make sure that you are using the correct url for the GET call from Ajax, and you can make sure of that by using Chrome developer tools (Network tab) and observer the exact url that Ajax calls. Maybe you need to add "/" before your page url or you need to specify the folder name if it's not in the same folder, like: "/otherFolder/page.aspx".

Bind Property of ASP.NET User Control to One of the Parent Control's Fields

If I need access to the value of a user control's property BEFORE PreRender, would I need to base the custom control off of one of the preexisting data controls (repeater, listview, etc.)?
One of my user controls features a gridview control that is configured based on the user control's properties on which it resides. Several of the key properties alter the SQL Statement for the underlying recordsource. I'm now in a situation where the property that sets the WHERE statement for the SQL Statement needs to tied to a value in the user control's parent FormView. Think of the formview as displaying a customer detail record. The user control takes the customer's account number and then displays data from a related table such as Customer Contact Names. Since the gridview is created before the control's prerender event, working within the prerender event doesn't seem efficient.
See this question as a reference:
Stumped With Custom Property on User Control
What I said that you can assign value to the parent control when user control binds.
TestIt.ascx - Markup
<%# Control Language="VB" AutoEventWireup="false"
CodeFile="TestIt.ascx.vb" Inherits="usercontrols_TestIt" %>
<asp:Label
ID="lblOne"
runat="server">
</asp:Label>
TestIt.ascx.vb
Partial Class usercontrols_TestIt
Inherits System.Web.UI.UserControl
Public Property No As Integer
Get
Dim mno As Integer = 0
Integer.TryParse(lblOne.Text, mno)
Return mno
End Get
Set(value As Integer)
lblOne.Text = value.ToString()
End Set
End Property
Public ReadOnly Property Square As Integer
Get
Return No * No
End Get
End Property
Protected Sub Page_PreRender(sender As Object, e As System.EventArgs) Handles Me.PreRender
'Get ref. of parent control
Dim row As FormViewRow = CType(Parent.Parent, FormViewRow)
'Find control in parent control
Dim sqLabel As Label = row.FindControl("Label2")
'Assign value
sqLabel.Text = Square.ToString()
End Sub
End Class
ASPX - Markup
<%# Page Language="VB" AutoEventWireup="false" CodeFile="VbDefault2.aspx.vb" Inherits="usercontrols_VbDefault2" %>
<%# Register src="TestIt.ascx" tagname="TestIt" tagprefix="uc1" %>
<!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>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:FormView ID="FormView1" runat="server" AllowPaging="True">
<ItemTemplate>
No :
<uc1:TestIt ID="TestIt1" runat="server" No='<%#Eval("No") %>'
ClientIDMode="AutoID" />
<br />
Square :
<asp:Label ID="Label2" runat="server" ></asp:Label>
</ItemTemplate>
</asp:FormView>
</div>
</form>
</body>
</html>
ASPX.vb
Partial Class usercontrols_VbDefault2
Inherits System.Web.UI.Page
Public Class TestData
Public Property No As Integer
End Class
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
BindData()
End If
End Sub
Sub BindData()
Dim nos As New List(Of TestData)
nos.Add(New TestData() With {.No = 10})
nos.Add(New TestData() With {.No = 20})
FormView1.DataSource = nos
FormView1.DataBind()
End Sub
Protected Sub FormView1_PageIndexChanging(sender As Object, e As System.Web.UI.WebControls.FormViewPageEventArgs) Handles FormView1.PageIndexChanging
FormView1.PageIndex = e.NewPageIndex
BindData()
End Sub
End Class

Declarative event handling from ASP.NET user control to page

I am trying to figure out how to declaratively pass in a event handler into
a user control, but I am stumped. All I can make work is the user control's
event handler.. I can't seem to bubble up the caught event into the parent
page. Ideas would be quite welcome. Here is my code:
Default.aspx:
<%# Page Language="VB" %>
<%# Register TagPrefix="rpt" TagName="filter" Src="WebUserControl.ascx" %>
<!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>Test Controls</title>
</head>
<body>
<form id="form1" runat="server">
<rpt:filter ID="DataView1Filters" runat="server" SelectedIndexChanged="DropDown_SelectedIndexChanged" />
<asp:Label ID="Label1" runat="server" />
</form>
<script runat="server">
Public Sub DropDown_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Label1.Text = String.Format("Inside declarative event handler. {0}<br>", Label1.Text)
End Sub
</script>
</body>
</html>
WebUserControl.ascx:
<%# Control Language="VB" ClassName="WebUserControlTest" %>
<asp:Panel ID="TestPanel" runat="server"></asp:Panel>
<script runat="server">
Private AllEvents As New System.ComponentModel.EventHandlerList
Public Custom Event SelectedIndexChanged As EventHandler
AddHandler(ByVal value As EventHandler)
AllEvents.AddHandler("SelectedIndexChanged", value)
End AddHandler
RemoveHandler(ByVal value As EventHandler)
AllEvents.RemoveHandler("SelectedIndexChanged", value)
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
Dim value As EventHandler = CType(AllEvents("SelectedIndexChanged"), EventHandler)
If Not value Is Nothing Then
value.Invoke(sender, e)
End If
End RaiseEvent
End Event
Private Sub _SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim ctrl As DropDownList = Me.FindControl("TestDropDownList")
If Not ctrl Is Nothing Then
Me.ViewState("ItemSelection") = ctrl.SelectedIndex
End If
Dim Label1 As Label = Parent.FindControl("Label1")
Label1.Text = String.Format("Inside user control event handler. {0}<br>", Label1.Text)
RaiseEvent SelectedIndexChanged(sender, e)
End Sub
Private Overloads Sub OnLoad(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim ctrl As New DropDownList
With ctrl
.ID = "TestDropDownList"
.Items.Clear()
.AutoPostBack = True
AddHandler .SelectedIndexChanged, AddressOf _SelectedIndexChanged
.Items.Add(New ListItem("-- Select --", String.Empty))
.Items.Add(New ListItem("Item 1", "1"))
.Items.Add(New ListItem("Item 2", "2"))
If Not Me.ViewState("ItemSelection") Is Nothing Then
.SelectedIndex = CInt(Me.ViewState("ItemSelection"))
Else
.SelectedIndex = 0
End If
End With
TestPanel.Controls.Add(ctrl)
End Sub
</script>
Thanks!
See this previous post:
Handling User Control Events on Containing Page
Edit - added based on your comment
I should have read the question more clearly.
As far as having a UserControl raise an event that the containing page can respond to, I do not believe that this can be done declaratively.
Unless my knowledge is just lacking, the only way to accomplish this is by explicitly creating an event in the control and then handling it (by coding the event handler) on the parent page, as shown in the example I linked to.
I was recently having this same issue in C#. When you set up an event called SelectedIndexChanged asp.net will bind the attribute OnSelectedIndexChanged when using the declarative syntax.
So if you change
<rpt:filter ID="DataView1Filters" runat="server" SelectedIndexChanged="DropDown_SelectedIndexChanged" />
To
<rpt:filter ID="DataView1Filters" runat="server" OnSelectedIndexChanged="DropDown_SelectedIndexChanged" />
It should work.

Resources