Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:13:04+00:00 2026-06-07T14:13:04+00:00

Currently I have an Ajax Timer which executes a function every few second. It

  • 0

Currently I have an Ajax Timer which executes a function every few second. It is working perfectly fine until I tried to retrieve data from a DataTable. I have no idea why. I have tried debugging. I even placed label on the page to check.

For example the Ajax Timer:

Protected Sub Timer1_Tick(sender As Object, e As System.EventArgs) Handles Timer1.Tick

    Label1.Text = DateTime.Now.ToLongTimeString()

End Sub

The datalist (the one giving the problem):

Protected Sub dlOrgProfile_ItemCreated(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlOrgProfile.ItemCreated
    Dim bizLayerMgmt As BlOrganizations
    Dim dt As DataTable

    bizLayerMgmt = New BlOrganizations()
    dt = bizLayerMgmt.getOrgDetails(userId).Tables(0)

    ddl = CType(e.Item.FindControl("ddlCoType"), DropDownList)
    Dim value As Integer = Convert.ToInt32(dt.Rows(0)(3)) 'I have narrowed the problem to this line, if I comment this line.. everything works perfectly
    ddl.SelectedValue = value
End Sub

The problem lies in the dt.Rows(0)(3). I have no idea why. I need to use it to retrieve some data from the database.

Just in case if its the front-end side.. here’s the markup for the site.

<div class="content">
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:Timer ID="Timer1" runat="server" Interval="1000">
            </asp:Timer>
            <asp:DataList ID="dlOrgProfile" runat="server" DataSourceID="odsOrgDetails" 
                EnableTheming="True" RepeatLayout="Flow" ShowFooter="False" ShowHeader="False">
                <ItemTemplate>
                    <h3>
                        <asp:TextBox ID="txBxCoName" runat="server" Text='<%# Eval("OrgName") %>'></asp:TextBox>

                        <div class="ddlSelect">
                            <asp:DropDownList ID="ddlCoType" runat="server" DataSource='<%# listOrgType() %>' DataTextField="OrganizationType" DataValueField="OrgTypeID" >
                            </asp:DropDownList>
                        </div>

                        <h3>
                        </h3>
                        <a id="linkCoImg" href="upload_co_logo.aspx">
                        <asp:Image ID="CoImg" runat="server" ImageUrl="~/logo/org/default.png" />
                        <span>Change</span> </a>
                        <br />
                        <div id="description">
                            <textarea id="taCoDesc" rows="2" cols="1"><%# Eval("Description") %></textarea>
                        </div>
                        <br />
                        <asp:Label ID="lblContacts" runat="server" Text="Contacts:"></asp:Label>
                        <br />
                        <div id="contacts">
                            <asp:TextBox ID="tbContactOffice" runat="server" CssClass="tbContacts"></asp:TextBox>
                            <asp:TextBox ID="tbContactFax" runat="server" CssClass="tbContacts"></asp:TextBox>
                            <asp:TextBox ID="tbContactMail" runat="server" CssClass="tbContacts2"></asp:TextBox>
                        </div>
                        <br />
                        <asp:Button ID="btnSave" runat="server" CommandArgument='<%# Eval("OrgID") %>' 
                            CommandName="save" Text="Save" />

                    </h3>

                </ItemTemplate>
            </asp:DataList>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
            </Triggers>
            <ContentTemplate>
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            </ContentTemplate>
            </asp:UpdatePanel>
        </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:13:06+00:00Added an answer on June 7, 2026 at 2:13 pm

    Okay I have resolved my own problem.. Still don’t really get it why but this is what I did.. Instead of using ItemCreated, I used ItemDataBound.

    Protected Sub dlOrgProfile_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlOrgProfile.ItemDataBound
        Dim bizLayerMgmt As BlOrganizations
        Dim dt As DataTable
    
        bizLayerMgmt = New BlOrganizations()
        dt = bizLayerMgmt.getOrgDetails(userId).Tables(0)
    
        ddl = CType(e.Item.FindControl("ddlCoType"), DropDownList)
        Dim value As Integer = Convert.ToInt32(dt.Rows(0)(3))
        ddl.SelectedValue = value
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in my Ajax, which executes a page reload function
I have an element which autosaves its contents via an AJAX call. Currently, whenever
O, so i have a 'live search' ajax search, which currently runs an sql
i have a function having a loop which sleeps for 6 second at the
I have a table of data which is generated dynamically with Javascript. Every few
I have a function which makes an AJAX request to a server and returns
I have an ajax function which call a servlet to get list of products
I currently have a ajax script that dynamically builds two select boxes enabled with
I currently have an Instance of the ASP.net ajax control toolkit combo box residing
I currently have a PHP form that uses AJAX to connect to MySQL and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.