• Advertisement
Sign in to follow this  

[.net] ASP.Net AJAX, not working with DataList?

This topic is 3360 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have an asp:DataList with data in it including an asp:LinkButton that fires the DataList's item command handler which uses the WebClient.DownloadFileAsync method. I have a WebClient DownloadProgressChanged handler that I want to use to update an asp:Label asynchronously with the ProgressPercentage. I tried putting the label inside of an UpdatePanel, tried putting both the DataList and Label inside the UpdatePanel, and so forth, with no luck. The text on the page for the label does not change, even though when I debug into the DownloadProgressChanged handler the label is being updated accordingly. I know that there are a number of controls that are incompatible with UpdatePanel, I'm wondering if somewhere in this process something is suffering from a limitation. Or is it something else? I added in a button to test out if ajax was working at all, and I was able to update a label ajaxically. With that in mind I decided to switch out the LinkButton in the DataList with a regular Button, which should be compatible, and within the DataList's item command handler I tried updatng a label, but nothing happened. So I'm leaning towards the problem being with the DataList component.
public void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        pnlTransfer.Visible = true;
#region instr1
        if (!System.IO.File.Exists(filename))
            pnlVideoPlayer.Visible = false;
            pnlTransfer.Visible = true;
            wc.DownloadFileAsync(vUrl, filename);
            pnlVideoPlayer.Visible = true;
            pnlTransfer.Visible = false;

    void wc_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
        lblTransfer.Text = "Transferring: " + e.ProgressPercentage.ToString() + "%";

                <div id="video_list_div" style="position:absolute; width:300px; top:30px; height:auto">
                    <asp:Panel ID="pnlVideoList" runat="server"  
                        style="margin-top: 22px" Width="495px" BackColor=LightGray Visible=false>
                        <asp:DataList id="DataList1" runat="server"
                                <hr />
                                <%# DataBinder.Eval(Container.DataItem, "StringValue") %>                        
                                <asp:linkbutton ID="Linkbutton2" Text="[Play]" 
CommandName='<%# DataBinder.Eval(Container.DataItem, "ID") %>' 
style="color:Black;font:8pt tahoma" runat="server"/><br />
                                <hr />


                <div id="transferring_div" style="position:absolute; left:700px; top:170px;">
                    <asp:Panel ID="pnlTransfer" runat="server" Visible=false>
                            <asp:Label ID="lblTransfer" runat="server" Text="11"></asp:Label>

[Edited by - ferr on November 9, 2008 2:13:22 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement