Hi Peter, Travis and everyone--
Peter, you're right. We are using an AJAX approach.
I tried using different Table properties (insertRow, appendChild),
etc. I couldn't get any of them to work. I changed
my "insertAdjacentHTML" to innerHTML, but that didn't help.
I am very, very new to all of this and have been trying to solve this
issue for several days (tearing code apart over and over and trying
new ways) -- which has produced no results other than my frustration
and desperation.
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, 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, 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.getElementById
("_ctl1__ctl0_ddlEmployee").value;
var StartDate = document.getElementById
("_ctl1__ctl0_TextStartDate").value;
var EndDate = document.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");
document.getElementById
("Table1Inner").innerHTML = xmlDoc.transformNode(xslDoc);
}
}
Thanks!
--- In [email protected], "Peter Brunone"
<[EMAIL PROTECTED]> wrote:
> Travis,
>
> AJAX is not a product or a tool. It is a recently-coined
> acronym to describe the several-years-old practice of data retrieval
> without refreshing the whole page. In fact, it looks like
Michelle's
> code below is already using an AJAX approach :)
>
> Michelle,
>
> It looks like you're trying to assign to a property called
> "insertAdjacentHTML" on a table (presumably the table containing the
> datagrid); where did you get this code, and what do you want it to
do?
> If you want to add rows to a table in the browser, you'll need to
read
> up on the object model, which you can do at
http://tinyurl.com/52nbl (MS
> HTML Reference).
> Let us know if you need more help.
>
> Cheers,
>
> Peter
>
> -----Original Message-----
> From: [email protected] On Behalf Of Falls,
Travis D
> (HTSC, CASD)
>
> AJAX is a tool to do server side calls and send the data to the
screen
> without a post back so you could recall the load of said
datagrid... I
> am having a serious NDM production issue but if no body else
explains
> this further I will try to when I get home tonight. sorry I can't
write
> more now.
>
> Travis D. Falls | Consultant RAFT.Net IT | 860.547.4070 |
> [EMAIL PROTECTED]
>
> -----Original Message-----
> From: [email protected] Behalf Of Michelle
Zancanaro
>
> Hi Travis --
>
> As I said, I'm new to all of this....anyway, I went to that link
and am
> not seeing any way to add a record to a datagrid without having the
page
> refresh.
>
> If you could provide some additional information/details, etc., I'd
> really appreciate it.
>
> Thanks,
> Michelle
>
> From: [email protected] n Behalf Of Falls,
Travis D
> (HTSC, CASD)
>
> There is an awosome product (free) called AJAX that allows you to do
> this.
> http://ajax.schwarz-interactive.de/csharpsample/default.aspx
>
> Has a learning curve but I think many on this list have used and is
> decently worth it.
>
> Travis D. Falls | Consultant RAFT.Net IT | 860.547.4070 |
> [EMAIL PROTECTED]
>
>
> From: [email protected]
>
> Hi --
>
> I'm fairly new to .NET. I've got a webform application that records
> the amount of time an employee spends on a job. The jobs/time for a
> given period are then displayed in a datagrid. I'd like it all to
run
> client side, so the screen doesn't load again.
>
> When I add a record, the information is added to the database
(we're
> using remote scripting for that). And the information in the
record
> is available if I do xmlDoc.transformNode(xslDoc) -- I can see that
> the info is retrieved when I view it using the command window in
> debugger mode.
>
> But.....the datagrid does not get updated with the new record. Has
> anyone added rows/records to a datagrid without a page refresh?
Any
> help/suggestions and especially sample code are greatly
appreciated!!
>
> Here's the Javascript function I'm using to load/reload the datagrid
> table (sorry about the way the text wrapped):
>
> function LoadTable()
> {
> var Employee = document.getElementById
> ("_ctl1__ctl0_ddlEmployee").value;
> var StartDate = document.getElementById
> ("_ctl1__ctl0_TextStartDate").value;
> var EndDate = document.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");
> document.getElementById
> ("Table1").insertAdjacentHTML = xmlDoc.transformNode(xslDoc);
> }
> }
------------------------ Yahoo! Groups Sponsor --------------------~-->
<font face=arial size=-1><a
href="http://us.ard.yahoo.com/SIG=12h1ckhus/M=362329.6886308.7839368.1510227/D=groups/S=1705006764:TM/Y=YAHOO/EXP=1123697194/A=2894321/R=0/SIG=11dvsfulr/*http://youthnoise.com/page.php?page_id=1992
">Fair play? Video games influencing politics. Click and talk back!</a>.</font>
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/