DCSIMG
Internet Explorer 8 Part 4 - Alternative Display Source - שלמה גולדברג (הרב דוטנט)

שלמה גולדברג (הרב דוטנט)

מרצה בסלע ויועץ בעולם ה - net.

Internet Explorer 8 Part 4 - Alternative Display Source

 

אנחנו כבר יודעים לייצר Web Slice פשוט וגם Web Slice שמביא את הנתונים ממקום אחר שבו נרשמו ל - Web Slice כדי לחסוך בתעבורה,
גם ראינו איך אפשר להגדיר ל - Web Slice חלון Preview באמצעות הגדרה של entry-content.
 
הבעייה הגדולה בחלון ה - Preview שהוא שומר את הנתונים במטמון לוקלי ולכן כל הסקריפטים וה - ActiveX חסומים.
 
כדי שנוכל להפעיל סקריפטים או לחצני צד שרת אנחנו צריכים להשתמש ב - Alternative Display Source, מה שזה אומר שגם חלון ה - Preview הולך לשרת כדי להביא את הנתונים, ושום דבר לא נשמר במטמון ולכן אפשר להפעיל סקריפטים וקוד שרץ בצד השרת.
 
הביצוע פשוט מאוד, בסך הכול צריך להוסיף:

<a rel="entry-content" href="display.html" style="display:none;"></a>

 
כשה - href מופנה לאותו דף שאמור להביא את ה - data עבור ה - Preview.
 
דוגמא מלאה:
 

<div class="hslice" id="StudentMessage123" style="width: 320px">

    <a rel="entry-content" href="2DynamicTitle.aspx#ads" style="display: none">

        <div dir="rtl" style="font-family: Arial;">

            <span class="entry-title"><b>הודעות לסטודנטים</b></span>

        </div>

    </a>

</div>

<br />

<br />

<div id="ads">

    <asp:BulletedList ID="BulletedList1" runat="server">

    </asp:BulletedList>

    <asp:Button ID="ff" runat="server" Text="ff" OnClick="ff_Click" />

    <asp:Label ID="lbl" runat="server"></asp:Label>

</div>

 

protected void Page_Load(object sender, EventArgs e)

{

    if (!IsPostBack)

    {

        BulletedList1.Items.Add("ביום שלישי הבא יתקיים יום פתוח מאת שלמה על C# 4.0 ");

        BulletedList1.Items.Add("יום הסטודנט בסלע מתקרב");

    }

}

 

protected void ff_Click(object sender, EventArgs e)

{

    lbl.Text = DateTime.Now.ToLongTimeString();

}

 
באתר אמיתי אנחנו נוציא מן הסתם את התוכן של ה - Preview לדף אחר או ל - UserControl.
 
בכל מקרה אי אפשר באמצעות  Alternative Display Source:
 
לפתוח alert, לייצר popup או לפתוח חלון Print וכדו'.
 
אי אפשר לבקש התקנה של ActivX, ולכן אנחנו אמורים לדעת שבמידה וה - Preview רוצה להשתמש ב - ActivX שהוא יהיה מותקן מראש.
 
אי אפשר לגרום להורדת קובץ.
 
אין גישה ל - window.external.
 
במידה ולא נגדיר ללינקים בתוך חלון ה - Preview (אם משתמשים ב - alternative display) שיפתחו בחלון נפרד (traget= _blank) הם יפתחו בחלון ה - Preview.
 
 
 
אפשר כמובן לשלב בין alternative update ו - alternative display.
 

<div class="hslice" id="auction">

    <span class="entry-title">Auction Item - Alternative Update</span>

    <a rel="feedurl" href="update.html#auction-update" style="display:none;"></a>

</div>

 

<%--update.html--%>

<div class="hslice" id="auction-update">

    <h2 class="entry-title">Auction Item - Alternative Display</h2>

    <div class="entry-content">Current bid is $66</div>

    <a rel="entry-content" href="display.html" style="display:none;"></a>

</div>

 
ושוב אתן את הלינק למאמר המלא ב MSDN - מומלץ בחום.

תוכן התגובה

שלמה גולדברג כתב/ה:

בפוסטים הקודמים כתבתי על Web Slice (עדיין נשאר לי לדבר על Authenticated Web Slices) כעת אני רוצה לדבר

# August 26, 2009 5:32 PM
שלח תגובה

(שדה חובה)  

(שדה חובה)  

(אופציונלי)

(שדה חובה) 

Please add 7 and 2 and type the answer here:


Enter the numbers above: