locked
what should i do? RRS feed

  • Question

  • User-810066752 posted
    • i wanna to make updates without refresh all page i wanna to see my updates at the same time  without scroll don page agin to see updates you understand?
    Monday, June 9, 2014 4:49 PM

Answers

  • User-1796506859 posted

    We may need a little more clarification on what you are trying to do.

    But if you dont want to see [page] refreshes then use an UpdatePanel  - if you dont want to scroll to view updated data then when you display your data [perhaps in a gridview] sort the new records to the top.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:33 PM
  • User-1416423428 posted

    i wanna to make updates without refresh all page

    You'd probably want to use ajax to load new content to your page/div/section.   That would avoid reloading the page.  

    http://api.jquery.com/load/ 

    Another option is Yahoo UI (node.load, or pjax). 

    http://yuilibrary.com/yui/docs/api/classes/Node.html

    http://yuilibrary.com/yui/docs/api/classes/Pjax.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:50 PM
  • User-810066752 posted

    <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">

    <ContentTemplate>

    <asp:Image ID="img20" runat="server" CssClass="lstpictemp"></asp:Image><asp:FileUpload ID="fil20" runat="server" /><asp:Button runat="server" ID="btnshare21" Text="Share" OnClick="btnshare21_Click" /><label id="lblnameimage20" runat="server">Name:</label><asp:TextBox id="txtnameimage20" runat="server" EnableViewState="false"></asp:TextBox><label id="lbldescriptionimage20" runat="server">Description:</label><textarea id="txtdescriptonimage20" runat="server"></textarea>

    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="btnshare21" />
    </Triggers>
    </asp:UpdatePanel></div>

    -----------------------------------------------------------------------------------------------------------------

    protected void btnshare21_Click(object sender, EventArgs e)
    {
    string fullpath = Server.MapPath("~/images/" + fil20.FileName);

    fil20.SaveAs(fullpath);
    fil20.Dispose();
    img20.ImageUrl = "~/images/" + fil20.FileName;
    FileStream fs = new FileStream(fullpath, FileMode.Open, FileAccess.Read);
    BinaryReader br = new BinaryReader(fs);
    FileInfo fn = new FileInfo(fullpath);
    byte[] imgarr = br.ReadBytes((int)fn.Length);
    DataManager.ExecuteNonQuery("uadvancedtemp", CommandType.StoredProcedure, DataManager.CreateParameter("@name", SqlDbType.NVarChar, txtnameimage.Text),
    DataManager.CreateParameter("@discription", SqlDbType.NVarChar, txtdescriptonimage.Value), DataManager.CreateParameter("@image", SqlDbType.Image, imgarr));
    fs.Close();
    }

    -------------------------------------------------------------------

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:54 PM
  • User-1716253493 posted

    To mantain page scroll, maybe you can set this property

    <%@ Page  Language="VB"  AutoEventWireup="False"  MaintainScrollPositionOnPostback = "true" %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 9:57 PM
  • User1918509225 posted

    Hi Mohamed,

    To maintain the scroll position for the large web page.you can try the methods below:

    1 Use web.config  page section <pages maintainScrollPositionOnPostBack="true">

    This will maintain the scroll positions for all the  web site pages.

    2 In the page declaration <%@ Page MaintainScrollPositionOnPostback = "true"  %>

    3 Here is a link which are related with your problem,please refer to below:

    http://www.c-sharpcorner.com/Blogs/11804/maintain-scroll-position-on-postback-within-updatepanel.aspx

     

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 2:15 AM
  • User724169276 posted

    Hello,

    Using update panels for the purpose of frequent updates on the page is not a good step to follow.You should use jquery ajax calls.Microsoft's AJAX UpdatePanels actually re-render the entire page, but then only replace the sections of data that you surrounded with the UpdatePanel tags.Performance-wise  ajax calls are better than update panels.A small example is shown below:

    SCRIPT:

    $("#MainContent_txtAmount").focusout(function Update() {
           $.ajax({
                url:"NumberToWord",
                data: {number: $(this).val() },
                dataType: 'json',
                success: function(data) {
                     alert(data.word);
    window.setTimeout(Update, 10000); } }); });

    CODEBEHIND:

    public ActionResult NumberToWord(decimal number)
    {
         var result =  // code to do convert 
         return Json(new {word = result});
    } 

    Source Here.

    For a detailed example you can see below reference:

    http://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquery-ajax-function-call-code-behind-C-Sharp-method/

    Hope This Helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 2:26 AM

All replies

  • User-1796506859 posted

    We may need a little more clarification on what you are trying to do.

    But if you dont want to see [page] refreshes then use an UpdatePanel  - if you dont want to scroll to view updated data then when you display your data [perhaps in a gridview] sort the new records to the top.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:33 PM
  • User-1416423428 posted

    i wanna to make updates without refresh all page

    You'd probably want to use ajax to load new content to your page/div/section.   That would avoid reloading the page.  

    http://api.jquery.com/load/ 

    Another option is Yahoo UI (node.load, or pjax). 

    http://yuilibrary.com/yui/docs/api/classes/Node.html

    http://yuilibrary.com/yui/docs/api/classes/Pjax.html

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:50 PM
  • User-810066752 posted

    <div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">

    <ContentTemplate>

    <asp:Image ID="img20" runat="server" CssClass="lstpictemp"></asp:Image><asp:FileUpload ID="fil20" runat="server" /><asp:Button runat="server" ID="btnshare21" Text="Share" OnClick="btnshare21_Click" /><label id="lblnameimage20" runat="server">Name:</label><asp:TextBox id="txtnameimage20" runat="server" EnableViewState="false"></asp:TextBox><label id="lbldescriptionimage20" runat="server">Description:</label><textarea id="txtdescriptonimage20" runat="server"></textarea>

    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="btnshare21" />
    </Triggers>
    </asp:UpdatePanel></div>

    -----------------------------------------------------------------------------------------------------------------

    protected void btnshare21_Click(object sender, EventArgs e)
    {
    string fullpath = Server.MapPath("~/images/" + fil20.FileName);

    fil20.SaveAs(fullpath);
    fil20.Dispose();
    img20.ImageUrl = "~/images/" + fil20.FileName;
    FileStream fs = new FileStream(fullpath, FileMode.Open, FileAccess.Read);
    BinaryReader br = new BinaryReader(fs);
    FileInfo fn = new FileInfo(fullpath);
    byte[] imgarr = br.ReadBytes((int)fn.Length);
    DataManager.ExecuteNonQuery("uadvancedtemp", CommandType.StoredProcedure, DataManager.CreateParameter("@name", SqlDbType.NVarChar, txtnameimage.Text),
    DataManager.CreateParameter("@discription", SqlDbType.NVarChar, txtdescriptonimage.Value), DataManager.CreateParameter("@image", SqlDbType.Image, imgarr));
    fs.Close();
    }

    -------------------------------------------------------------------

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 5:54 PM
  • User-1716253493 posted

    To mantain page scroll, maybe you can set this property

    <%@ Page  Language="VB"  AutoEventWireup="False"  MaintainScrollPositionOnPostback = "true" %>

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2014 9:57 PM
  • User1918509225 posted

    Hi Mohamed,

    To maintain the scroll position for the large web page.you can try the methods below:

    1 Use web.config  page section <pages maintainScrollPositionOnPostBack="true">

    This will maintain the scroll positions for all the  web site pages.

    2 In the page declaration <%@ Page MaintainScrollPositionOnPostback = "true"  %>

    3 Here is a link which are related with your problem,please refer to below:

    http://www.c-sharpcorner.com/Blogs/11804/maintain-scroll-position-on-postback-within-updatepanel.aspx

     

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 2:15 AM
  • User724169276 posted

    Hello,

    Using update panels for the purpose of frequent updates on the page is not a good step to follow.You should use jquery ajax calls.Microsoft's AJAX UpdatePanels actually re-render the entire page, but then only replace the sections of data that you surrounded with the UpdatePanel tags.Performance-wise  ajax calls are better than update panels.A small example is shown below:

    SCRIPT:

    $("#MainContent_txtAmount").focusout(function Update() {
           $.ajax({
                url:"NumberToWord",
                data: {number: $(this).val() },
                dataType: 'json',
                success: function(data) {
                     alert(data.word);
    window.setTimeout(Update, 10000); } }); });

    CODEBEHIND:

    public ActionResult NumberToWord(decimal number)
    {
         var result =  // code to do convert 
         return Json(new {word = result});
    } 

    Source Here.

    For a detailed example you can see below reference:

    http://www.c-sharpcorner.com/UploadFile/dacca2/understand-jquery-ajax-function-call-code-behind-C-Sharp-method/

    Hope This Helps.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, June 10, 2014 2:26 AM