Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi

i have some controls in update panel like text box, drop down list and all

i face a problem when my timer do Post back the selected value of dropdown list get reset here is my code

ASP.NET
<asp:Timer ID="Timer1" runat="server" Interval="1500" Enabled="false">
            </asp:Timer>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
        </Triggers>
        <ContentTemplate>
                 Select a Device :
            <asp:DropDownList ID="ddlDevices" runat="server" Width="300px" />
time : <asp:TextBox ID="txtDate" runat="server" />
        </ContentTemplate>
        
    </asp:UpdatePanel>


VB
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            txtDate.Text =now
            ' filling the Drop Down List From DataBase
            GenModule.FillCombo("MstVehicle", "nDevice_Id", "sDevice_Id", ddlDevices, False)
            
            'ddlDevices.SelectedIndex = 0

            Timer1.Enabled = True
            Timer1_Tick(Timer1, System.EventArgs.Empty)
        End If

End Sub
'---------------------------------------------------------
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ' doing Some work like 
        ' retriving data from database
        ' and populating
End Sub


thats my Code

by default dropdown list selected index is 0 [thats First item in list]
when i try to select another item from list its not getting selected

can any one help me out with this plz
Thanks in Advance
Posted
Comments
virang_21 29-May-13 20:06pm    
make sure in your timer control's tick event you have UpdatePanel1.Update() method called at the end.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900