2011-09-15 11 views
1

タブを持つasp Webアプリケーションを使用しています。そのタブをクリックすると、xmlファイルが読み込まれます。そのxmlファイルにはデータが入っています。そのxmlファイルは、xmlファイル内のxmlデータをブラウザで表現可能な方法で表示するためのテーブルを作成するためのコードを記述したxsltファイルを指すhrefを持っています。ボタンを使用してxmlファイルを更新する

ユーザーはxmlファイル内のデータを変更することがあります。また、実行時にデータを削除することもできます。 xsltファイルにリフレッシュボタンを追加しました。実行時に、ユーザーがxmlファイルを変更した場合は、更新ボタンをクリックして、Webページのテーブルの変更を反映させたいと思います。 XMLファイルをリフレッシュし、対応する変更をWebページに反映させたいだけです。

どうすればよいですか?私は下の私のコードをアップロードしています

ASPXファイル

<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="sampleapp._Default" %> 

<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 

<html> 
<head id="Head1" runat="server"> 
<meta http-equiv="Cache-Control" content="no-cache"/> 
     <meta http-equiv="Pragma" content="no-cache"/> 
     <meta http-equiv="Expires" content="0"/> 

     <title>VPGate Configuration</title> 
     <link rel="stylesheet" type="text/css" href="office2007.css"/> 
     <link rel="stylesheet" type="text/css" href="style002.css"/> 
     <script language="javascript" type="text/javascript"> 
      function window.onload() { 
       try { 
        if (self != top) 
         self.parent.location = document.location; 

       } 
       catch (Exception) { } 
      } 
     </script> 
</head> 
<body> 
<form id="form1" runat="server"> 
<telerik:RadScriptManager ID="RadScriptManager1" Runat="server"> 
</telerik:RadScriptManager> 
<script type="text/javascript"> 
    function OnClientTabSelected(sender, eventArgs) { 
     var tab = eventArgs.get_tab(); 
     if (tab.get_tabs().get_count() > 0) { 
      tab.get_tabs().getTab(0).select(); 
      //tab.get_tabs().getTab(0).click(); 
     } 
     if (tab.get_text() == "Help") { 
      document.getElementById("helpframe").style.display = "inline"; 
      document.getElementById("framebody").style.display = "none"; 
      document.getElementById("framebody").src = ""; 
      if (document.getElementById("helpframe").src == "") 
       document.getElementById("helpframe").src = "/help/ApplicationHelp.htm"; 
     } 
     else { 
      document.getElementById("helpframe").style.display = "none"; 
      document.getElementById("framebody").style.display = "inline"; 
     } 
    } 
    function OnClientTabSelecting(sender, eventArgs) { 
     if (!formchk2()) { 
      eventArgs.set_cancel(true); 
      return false; 
     } 
    } 
    </script> 
<telerik:RadTabStrip ID="tab1" runat="server" ShowBaseLine="True" 
      EnableEmbeddedSkins="False" ClickSelectedTab="True" 
      UnSelectChildren="True" SelectedIndex="3" 
      OnClientTabSelected="OnClientTabSelected" Skin="Office2007" style="margin-left: 29px;border-left-style:none;" 
    OnClientTabSelecting="OnClientTabSelecting"> 
    <Tabs> 
    <telerik:RadTab Text="General" NavigateUrl="ShowXML.aspx?file=MMDiagnostics.xml" Target="framebody" Selected="true"></telerik:RadTab> 
    </Tabs> 
     </telerik:RadTabStrip> 
    <iframe id="framebody" name="framebody" runat="server" 
      style="border-left: thin solid #4173be; border-right: thin solid #4173be; border-bottom: thin solid #4173be; height:112%; width:100%; border-top-width:0px; border-top-color:White; 
      background-color:white; float:left;height:92.5%; width:97.4%; margin-left:9.5px;" 
      frameborder="0" scrolling="no"> 
    </iframe> 
     </form> 
     </body> 
</html> 

XMLファイル

<?xml-stylesheet type="text/xsl" href="MMDiagnostics.xslt"?> 

<MediaMixer> 

    <Conference> 
    <Name>Test001</Name> 
    <ConfId>1000</ConfId> 
    <CompositeAddress>238.57.0.1</CompositeAddress> 
    <CompositePort>48000</CompositePort> 
    <CompositeSsrc>243324353</CompositeSsrc> 
    <NoOfParticipants>2</NoOfParticipants> 

    <Participant> 
     <ID1>80542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.40</ParticipantAddress> 
     <ParticipantListeningPort>22000</ParticipantListeningPort> 
     <MMListeningPort>45000</MMListeningPort> 
     <SSRCFromParticipant>216541</SSRCFromParticipant> 
     <SSRCFromMM>56481</SSRCFromMM> 
    </Participant> 

    <Participant> 
     <ID1>80542151</ID1> 
     <ID2>harish</ID2> 
     <ParticipantAddress>192.168.177.40</ParticipantAddress> 
     <ParticipantListeningPort>22000</ParticipantListeningPort> 
     <MMListeningPort>45000</MMListeningPort> 
     <SSRCFromParticipant>216541</SSRCFromParticipant> 
     <SSRCFromMM>56481</SSRCFromMM> 
    </Participant> 

    <Participant> 
     <ID1>7825482</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.22</ParticipantAddress> 
     <ParticipantListeningPort>22002</ParticipantListeningPort> 
     <MMListeningPort>45002</MMListeningPort> 
     <SSRCFromParticipant>3256</SSRCFromParticipant> 
     <SSRCFromMM>14822456</SSRCFromMM> 
    </Participant> 

    </Conference> 

    <Conference> 
    <Name>Test002</Name> 
    <ConfId>1002</ConfId> 
    <CompositeAddress>238.57.0.1</CompositeAddress> 
    <CompositePort>48005</CompositePort> 
    <CompositeSsrc>353324353</CompositeSsrc> 
    <NoOfParticipants>2</NoOfParticipants> 

    <Participant> 
     <ID1>70542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.45</ParticipantAddress> 
     <ParticipantListeningPort>22004</ParticipantListeningPort> 
     <MMListeningPort>45004</MMListeningPort> 
     <SSRCFromParticipant>316541</SSRCFromParticipant> 
     <SSRCFromMM>26481</SSRCFromMM> 
    </Participant> 
    <Participant> 
     <ID1>70542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.45</ParticipantAddress> 
     <ParticipantListeningPort>22004</ParticipantListeningPort> 
     <MMListeningPort>45004</MMListeningPort> 
     <SSRCFromParticipant>316541</SSRCFromParticipant> 
     <SSRCFromMM>26481</SSRCFromMM> 
    </Participant> 
    <Participant> 
     <ID1>70542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.45</ParticipantAddress> 
     <ParticipantListeningPort>22004</ParticipantListeningPort> 
     <MMListeningPort>45004</MMListeningPort> 
     <SSRCFromParticipant>316541</SSRCFromParticipant> 
     <SSRCFromMM>26481</SSRCFromMM> 
    </Participant> 
    <Participant> 
     <ID1>70542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.45</ParticipantAddress> 
     <ParticipantListeningPort>22004</ParticipantListeningPort> 
     <MMListeningPort>45004</MMListeningPort> 
     <SSRCFromParticipant>316541</SSRCFromParticipant> 
     <SSRCFromMM>26481</SSRCFromMM> 
    </Participant> 
    <Participant> 
     <ID1>70542151</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.45</ParticipantAddress> 
     <ParticipantListeningPort>22004</ParticipantListeningPort> 
     <MMListeningPort>45004</MMListeningPort> 
     <SSRCFromParticipant>316541</SSRCFromParticipant> 
     <SSRCFromMM>26481</SSRCFromMM> 
    </Participant> 

    <Participant> 
     <ID1>5625482</ID1> 
     <ID2>0</ID2> 
     <ParticipantAddress>192.168.177.20</ParticipantAddress> 
     <ParticipantListeningPort>22006</ParticipantListeningPort> 
     <MMListeningPort>45006</MMListeningPort> 
     <SSRCFromParticipant>8256</SSRCFromParticipant> 
     <SSRCFromMM>41822456</SSRCFromMM> 
    </Participant> 

    </Conference> 

</MediaMixer> 

XSLTファイル

<?xml version="1.0" encoding="iso-8859-1"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:template match="/"> 

    <html> 
     <head> 
     <title>VPGate Media Mixer</title> 

     <meta http-equiv="expires" content="0"/> 
     <meta http-equiv="pragma" content="no-cache"/> 
     <meta http-equiv="cache-control" content="no-cache, must-revalidate"/> 
     <meta http-equiv="refresh" content="15"></meta> 
     <script src="/Common/common.js\" type="text/javascript"></script> 
     <link rel="stylesheet" type="text/css" href="style001.css" /> 
     <link rel="stylesheet" type="text/css" href="Grid.Default.css" /> 


     </head> 

     <body class="WorkArea">  
     <div class="divSummaryHeader" id="SummaryHeader"> 
      <h1>Media Mixer - VPGate</h1> 

      <xsl:for-each select="MMDiagnostics/Conference"> 
      <h1> 
       Media Mixer - <xsl:value-of select="name"/> 
      </h1> 
      </xsl:for-each> 
     </div> 

     &#160; 



     <div class="RadGrid RadGrid_Default" id="SummaryData" style="position:absolute;width:630px;overflow:auto"> 

      <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" > 
      <tr> 
       <input type="button" class="formEditBtn" id="SubBtn" value="Refresh" onclick="window.location=window.location;"/> 

       </tr> 
       <tr> 
       <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Conference</td> 
       </tr> 

       <tr> 
       <td> 
        <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" > 
        <tr> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Name</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Conference Id</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Address</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Port</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Composite Ssrc</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">No Of Participants</td> 
        </tr> 

        <xsl:for-each select="MediaMixer/Conference"> 
         <!--<xsl:sort select="Name"/>--> 
         <xsl:if test="(position() mod 2 = 0)"> 

         <tr class="rgAltRow SummaryTableDataRow"> 
          <td valign = "top"> 
          <xsl:value-of select="Name"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="ConfId"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="CompositeAddress"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="CompositePort"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="CompositeSsrc"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="NoOfParticipants"/> 
          </td> 
         </tr> 
         </xsl:if> 

         <xsl:if test="(position() mod 2 = 1)"> 
         <td bgcolor="#aaaaff"> 
          <tr class="rgAltRow SummaryTableDataRow"> 
          <td valign = "top"> 
           <xsl:value-of select="Name"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="ConfId"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="CompositeAddress"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="CompositePort"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="CompositeSsrc"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="NoOfParticipants"/> 
          </td> 
          </tr> 
         </td> 
         </xsl:if> 

        </xsl:for-each> 

        </table> 
       </td> 
       </tr> 
      </table> 

      &#160; 

      <table border="0" class="rgMasterTable rgClipCells" cellspacing="1" cellpadding="1" > 
       <tr> 
       <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;" colspan="2">Participant</td> 
       </tr> 

       <tr> 
       <td> 

        <table border="0" class="rgMasterTable rgClipCells" cellspacing="0" cellpadding="0" > 
        <tr> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 1</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">ID 2</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Address</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">Participant Listening Port</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">MM Listening Port</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From Participant</td> 
         <td class="rgHeader SummaryTableHdrRow" style="font-weight:bold;">SSRC From MM</td> 
        </tr> 

        <xsl:for-each select="MediaMixer/Conference/Participant"> 

         <xsl:if test="(position() mod 2 = 0)"> 

         <tr class="rgAltRow SummaryTableDataRow"> 
          <td valign = "top"> 
          <xsl:value-of select="ID1"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="ID2"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="ParticipantAddress"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="ParticipantListeningPort"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="MMListeningPort"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="SSRCFromParticipant"/> 
          </td> 
          <td valign = "top"> 
          <xsl:value-of select="SSRCFromMM"/> 
          </td> 
         </tr> 
         </xsl:if> 

         <xsl:if test="(position() mod 2 = 1)"> 
         <td bgcolor="#aaaaff"> 
          <tr class="rgAltRow SummaryTableDataRow"> 
          <td valign = "top"> 
           <xsl:value-of select="ID1"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="ID2"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="ParticipantAddress"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="ParticipantListeningPort"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="MMListeningPort"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="SSRCFromParticipant"/> 
          </td> 
          <td valign = "top"> 
           <xsl:value-of select="SSRCFromMM"/> 
          </td> 

          </tr> 
         </td> 
         </xsl:if> 
        </xsl:for-each> 

        </table> 
       </td> 
       </tr> 
      </table> 


      &#160; 


      <div style="display:none"> 
       <iframe id="frameUpdate" name="frameUpdate" width="100%"></iframe> 
      </div> 


      </div> 

      </body> 
    </html> 
    </xsl:template> 
</xsl:stylesheet> 
+0

あなたはこれを削除したいという欲求を表明しました...私は聞くことができます:なぜですか? –

答えて

0

Y setTimeout関数を使用してクライアントサイドタイマーで設定できます。 xmlを読み込んで、ファイルの修正日である を確認してください。例えば、XMLのchangedDateに属性を設定し、毎回 をチェックすることができます。前のバージョンから変更されている場合は、XMLをリフレッシュできます。

0

これまで説明したように、xmlの変更されたデータをチェックしたり、XMLの属性 "ModifiedDate"を設定することができます。 誰かがXMLを更新するときに、属性の更新を変更する必要があります。

関連する問題