locked
How do I make datalist to show post when data is submitted immediately without refreshing the page? RRS feed

  • Question

  • User-2074858223 posted
    How do I make datalist to show post when data is submitted immediately without refreshing the page?
    Monday, May 30, 2016 8:35 PM

All replies

  • User475983607 posted

    The technology you're after is called AJAX.  You can go the ASP Forms route and implement an UpdatePanel.  

    Alternatively, you can go with pure JavaScript/JQuery and WebMethods and return a DataList.

    Monday, May 30, 2016 11:48 PM
  • User61956409 posted

    Hi micah2012,

    How do I make datalist to show post when data is submitted immediately without refreshing the page?

    You could use jQuery AJAX to post data to server and you could create rows and append rows to DataList control on AJAX success callback function. The following article explained how to dynamically populate GridView control using jQuery AJAX and Webmethods, you could refer to it to implement same functionality with your DataList control.

    http://www.aspsnippets.com/Articles/Bind-Dataset-to-ASPNet-GridView-using-jQuery-AJAX.aspx

    Best Regards,

    Fei Han

    Friday, June 3, 2016 9:23 AM
  • User768703680 posted

    Hi,

    Please use the code mentioned below.

     

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    /ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="" />
    
    </Triggers>
    </asp:UpdatePanel>
    </form>


     

    Friday, June 3, 2016 10:56 AM
  • User-2074858223 posted
    Thats all?, no code behind?
    Saturday, June 4, 2016 6:36 PM
  • User475983607 posted

    Thats all?, no code behind?

    Read the reference documentation in my previous post.  The reference docs contains sample code and better yet a detailed explanation of the technology and how to use the technology.   

    Next, design and your write code.

    If you need help post your source code along with a thoughtful explanation of the expected results and the actual results.  

    Saturday, June 4, 2016 10:52 PM
  • User-2074858223 posted

    i used this method to update datalist once data is posted and it didnt work

    <asp:Button ID="Button1" 
                Text="Refresh Panel"
                runat="server" />
    <asp:ScriptManager ID="ScriptManager1" 
                       runat="server" />
    <asp:UpdatePanel ID="UpdatePanel1" 
                     UpdateMode="Conditional"
                     runat="server">
                     <Triggers>
                       <asp:AsyncPostBackTrigger ControlID="Button1" />
                     </Triggers>
                     <ContentTemplate>
                     <fieldset>
                     <legend>UpdatePanel content</legend>
                     <%=DateTime.Now.ToString() %>
    <asp:DataList ID="DataList1" runat="server">
     <ItemTemplate>
    
    <asp:Label ID="content" runat="server" ></asp:Label>
    
    </ItemTemplate>
    </asp:DataList>
    </fieldset> </ContentTemplate> </asp:UpdatePanel>

    Wednesday, June 22, 2016 7:47 PM