Professional Web Applications Themes

How do I refresh a datagrid client side? - ASP.NET Data Grid Control

Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my code apart over and over each time I tried what I thought would be the code that would solve my problem. Maybe I'm going down the completely wrong path here. Essentially, here is an explanation of my ASP.NET webform application and what I want it to do: Employees add how much time they spend on a job, and then that information ...

  1. #1

    Default How do I refresh a datagrid client side?

    Hi --

    I'm very, very new to ASP.Net, and I've been trying for several days to
    figure out how to update a datagrid AND refresh it on the client side so
    that the page doesn't refresh. I've torn my code apart over and over each
    time I tried what I thought would be the code that would solve my problem.

    Maybe I'm going down the completely wrong path here. Essentially,
    here is an explanation of my ASP.NET webform application and what I
    want it to do:

    Employees add how much time they spend on a job, and then that
    information is added to a SQL database and displayed in a datagrid.
    I've got everything working on the client side (we are using an AJAX
    approach), except the refreshing
    of the datagrid.

    When the page loads and/or when a new record is added, I want the
    datagrid to update (without the page refreshing). The information
    that is returned is in XML format, and I somehow have to get it into
    the datagrid.

    Here's one record of the XML that is returned into variable
    oResult.value:

    "<ROOT><NewDataSet>
    <ActivityHistory>
    <ActivityID>312</ActivityID>
    <CustomerName>Test</CustomerName>
    <Description>312-Development</Description>
    <ActivityDate>2005-08-10T00:00:00.0000000-05:00</ActivityDate>
    <ReferenceCode>J-1007</ReferenceCode>
    <Minutes>15.00</Minutes>
    </ActivityHistory>
    </NewDataSet></ROOT>"

    But for a given period of time, there will be several of these
    ActivityHistory records.

    Below is the function I have so far (sorry about the wrapping), but as I
    said, I could be going
    down a completely wrong path. I would greatly appreciate if any of
    you have corrections for my code or if you have ideas/suggestions for
    a different/better way to do this (since my way doesn't work,
    anything would be better). Yes, I'm a newbie, and I'm just
    not "getting" this at all. I have no idea what to do now that
    nothing has worked thus far.



    function LoadTable()
    {

    var Employee = doent.getElementById
    ("_ctl1__ctl0_ddlEmployee").value;
    var StartDate = doent.getElementById
    ("_ctl1__ctl0_TextStartDate").value;
    var EndDate = doent.getElementById
    ("_ctl1__ctl0_TextEndDate").value;

    // Update the xml island with the employee history
    information
    var oResult = Methods.EmployeeActivity(Employee,
    StartDate, EndDate);

    var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    xmlDoc.async=false;
    xmlDoc.load("activityhistory.xml");

    var loaded = xmlDoc.loadXML(oResult.value);
    if (loaded) {
    var xslDoc=new ActiveXObject
    ("Microsoft.XMLDOM");
    xslDoc.async=false;
    xslDoc.load("ActivityHistoryStyle.xsl");
    doent.getElementById
    ("Table1Inner").innerHTML = xmlDoc.transformNode(xslDoc);
    }
    }

    Thanks!


    msnews Guest

  2. #2

    Default RE: How do I refresh a datagrid client side?

    Hi,

    I think you are going worng way. there is no way to do this at client side.

    Regards
    Sachin Saki
    ..NET Developer




    Sachin Saki Guest

  3. #3

    Default Re: How do I refresh a datagrid client side?

    Here's an approach:

    [url]http://staff.develop.com/ballen/blog/PermaLink.aspx?guid=c35c43f6-5686-40ee-9752-8095a848d821[/url]

    It's targeted at 2.0, but you can retrofit it to 1.1 using Jason Diamond's
    AJAX implementation:

    [url]http://jason.diamond.name/weblog/2005/07/29/my-ajax-dot-net-release-3[/url]

    -Brock
    DevelopMentor
    [url]http://staff.develop.com/ballen[/url]


    > Hi --
    >
    > I'm very, very new to ASP.Net, and I've been trying for several days
    > to figure out how to update a datagrid AND refresh it on the client
    > side so that the page doesn't refresh. I've torn my code apart over
    > and over each time I tried what I thought would be the code that would
    > solve my problem.
    >
    > Maybe I'm going down the completely wrong path here. Essentially, here
    > is an explanation of my ASP.NET webform application and what I want it
    > to do:
    >
    > Employees add how much time they spend on a job, and then that
    > information is added to a SQL database and displayed in a datagrid.
    > I've got everything working on the client side (we are using an AJAX
    > approach), except the refreshing
    > of the datagrid.
    > When the page loads and/or when a new record is added, I want the
    > datagrid to update (without the page refreshing). The information that
    > is returned is in XML format, and I somehow have to get it into the
    > datagrid.
    >
    > Here's one record of the XML that is returned into variable
    > oResult.value:
    >
    > "<ROOT><NewDataSet>
    > <ActivityHistory>
    > <ActivityID>312</ActivityID>
    > <CustomerName>Test</CustomerName>
    > <Description>312-Development</Description>
    > <ActivityDate>2005-08-10T00:00:00.0000000-05:00</ActivityDate>
    > <ReferenceCode>J-1007</ReferenceCode>
    > <Minutes>15.00</Minutes>
    > </ActivityHistory>
    > </NewDataSet></ROOT>"
    > But for a given period of time, there will be several of these
    > ActivityHistory records.
    >
    > Below is the function I have so far (sorry about the wrapping), but as
    > I
    > said, I could be going
    > down a completely wrong path. I would greatly appreciate if any of
    > you have corrections for my code or if you have ideas/suggestions for
    > a different/better way to do this (since my way doesn't work,
    > anything would be better). Yes, I'm a newbie, and I'm just
    > not "getting" this at all. I have no idea what to do now that
    > nothing has worked thus far.
    > function LoadTable()
    > {
    > var Employee = doent.getElementById
    > ("_ctl1__ctl0_ddlEmployee").value;
    > var StartDate = doent.getElementById
    > ("_ctl1__ctl0_TextStartDate").value;
    > var EndDate = doent.getElementById
    > ("_ctl1__ctl0_TextEndDate").value;
    > // Update the xml island with the employee history
    > information
    > var oResult = Methods.EmployeeActivity(Employee,
    > StartDate, EndDate);
    > var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    > xmlDoc.async=false;
    > xmlDoc.load("activityhistory.xml");
    > var loaded = xmlDoc.loadXML(oResult.value);
    > if (loaded) {
    > var xslDoc=new ActiveXObject
    > ("Microsoft.XMLDOM");
    > xslDoc.async=false;
    > xslDoc.load("ActivityHistoryStyle.xsl");
    > doent.getElementById
    > ("Table1Inner").innerHTML = xmlDoc.transformNode(xslDoc);
    > }
    > }
    > Thanks!
    >


    Brock Allen Guest

Similar Threads

  1. Client Side validation on datagrid
    By kusum@emw in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: May 30th, 01:58 PM
  2. Populate Datagrid from Client side
    By Vijay Kerji in forum ASP.NET Data Grid Control
    Replies: 1
    Last Post: November 23rd, 11:25 AM
  3. datagrid and client side scripts to add row
    By John Smith in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 30th, 06:58 AM
  4. Replies: 1
    Last Post: August 19th, 10:41 AM
  5. Client side validation of a DataGrid
    By Hrvoje Vrbanc in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: August 11th, 12:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139