How do I refresh a datagrid client side

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • msnews

    #1

    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><NewData Set>
    <ActivityHistor y>
    <ActivityID>312 </ActivityID>
    <CustomerName>T est</CustomerName>
    <Description>31 2-Development</Description>
    <ActivityDate>2 005-08-10T00:00:00.000 0000-05:00</ActivityDate>
    <ReferenceCode> J-1007</ReferenceCode>
    <Minutes>15.0 0</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 = document.getEle mentById
    ("_ctl1__ctl0_d dlEmployee").va lue;
    var StartDate = document.getEle mentById
    ("_ctl1__ctl0_T extStartDate"). value;
    var EndDate = document.getEle mentById
    ("_ctl1__ctl0_T extEndDate").va lue;

    // Update the xml island with the employee history
    information
    var oResult = Methods.Employe eActivity(Emplo yee,
    StartDate, EndDate);

    var xmlDoc=new ActiveXObject(" Microsoft.XMLDO M");
    xmlDoc.async=fa lse;
    xmlDoc.load("ac tivityhistory.x ml");

    var loaded = xmlDoc.loadXML( oResult.value);
    if (loaded) {
    var xslDoc=new ActiveXObject
    ("Microsoft.XML DOM");
    xslDoc.async=fa lse;
    xslDoc.load("Ac tivityHistorySt yle.xsl");
    document.getEle mentById
    ("Table1Inner") .innerHTML = xmlDoc.transfor mNode(xslDoc);
    }
    }

    Thanks!



  • Cor Ligthert [MVP]

    #2
    Re: How do I refresh a datagrid client side

    MSNews

    The webform datagrid is a ServerSide *data* grid.

    In my opinion do you want to use it as an HTML table.

    I would than take an HTML table in that case.

    Just my idea

    Cor


    Comment

    Working...