Integrating scripts with html

Discussion in 'ASP .Net Web Controls' started by Morris Neuman, Jun 8, 2009.

  1. Hi,

    I am working with Expression Web2 and am trying to add a script to set a
    multiview activeviewindex within an html page.

    The command button is defined as follows:
    <div class="col-1">
    <p><strong><a name="Overview"></a>Lorem
    ipsum dolor sit amet</strong>, consectetuer adipiscing elit, sed diam nonummy
    nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi
    enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
    lobortis nisl ut aliquip ex ea commodo consequat.</p>
    <asp:MultiView runat="server"
    id="MultiView1" ActiveViewIndex="0">
    <asp:View runat="server" id="View1">
    <ul class="list">
    <li><a href="#">View 1</a></li>
    <li><a href="#">Diam nonummy nibh</a></li>
    <li><a href="#">Euismod tincidunt ut
    laoreet dolore</a></li>
    <li><a href="#">Magna aliquam erat
    volutpat.</a></li>
    </ul>
    <a href="#"
    class="link-1"><span><span>Learn more</span></span></a>
    <div class="clear"></div></asp:View>
    <asp:View runat="server" id="View2">
    <ul class="list">
    <li><a href="#">View 2</a></li>
    <li><a href="#">Diam nonummy nibh</a></li>
    <li><a href="#">Euismod tincidunt ut
    laoreet dolore</a></li>
    <li><a href="#">Magna aliquam erat
    volutpat.</a></li>
    </ul>
    <a href="#"
    class="link-1"><span><span>Learn more</span></span></a>
    <div class="clear"></div></asp:View>

    </asp:MultiView>
    </div>


    I have added a script as follows in the body section of the .aspx page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>SpeechSoft Home Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <meta content="Telephony, telephony software, voicemail software, voice mail
    software, ivr software, ivr, outcall, attendant " name="keywords" />
    <link href="style.css" rel="stylesheet" type="text/css" />
    <link href="layout.css" rel="stylesheet" type="text/css" />
    </head>

    <body id="page1">
    <script runat="server" type="text/javascript">
    protected void ShowView2((object sender, EventArgs e)
    {
    // Determine which button was clicked
    // and set the ActiveViewIndex property to
    // the view selected by the user.
    MultiView1.ActiveViewIndex = 1;
    }
    </script>

    <div id="main">
    <!-- header -->
    <div id="header">
    <p>www.speechsoft.com</p>
    <ul id="navi">
    <li><a href="aboutSS-contacts.html">About Us</a></li>
    <li><a href="aboutSS-contacts.html">Contact</a></li>
    <!--<li><a href="#">sIGN iN</a></li>-->
    <!--<li><a href="#">sEARCH</a></li>-->
    <!--<li><a href="#">HELP</a></li>-->
    <!--<li><a href="#">faq</a></li>-->
    </ul>


    I have worked mostly with aspx and not had to combine with html. I
    purchased web templates for the graphics and flas but want to maintain them
    in .net.

    I have a couple of questions:
    Is this the correct place to add the script?
    Why is ShowView2 in the script made into a link?
    Can I use expression web 2 for .net commands?
    How can I use silverlight2 commands in this expression web2 project?

    As always, your help is much appreciated.

    Thanks
    Morris
     
    Morris Neuman, Jun 8, 2009
    #1
    1. Advertising

  2. Hi Morris,

    >Is this the correct place to add the script?


    Please refer to this tutorial:

    http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/multivi
    ew.aspx

    C# source code:

    http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/sam
    ples/ctrlref/standard/MultiView/MultiView1.src&file=multiview1_cs.aspx&lang=
    C%23+Source

    >Why is ShowView2 in the script made into a link?


    Could you clarify what do you mean by "made into a link"? You can send me a
    demo to clarify the problem. My email is update
    here after sending the project in case I missed that email.

    >Can I use expression web 2 for .net commands?


    Expression Web 2 can be used to edit aspx files. We can use it to edit the
    style of ASP.NET controls. This tool is mainly used by web site designers.
    If you want to add code logic you can do that in Visual Studio since it's
    web site developers' work.

    >How can I use silverlight2 commands in this expression web2 project?


    You cannot use Expression Web to code/style Silverlight application. Visual
    Studio is the IDE for coding and Expression Blend & Expression Designer is
    the tool to style Silverlight application.

    If you have additional questions please feel free to ask.

    Regards,
    Allen Chen
    Microsoft Online Support

    Delighting our customers is our #1 priority. We welcome your comments and
    suggestions about how we can improve the support we provide to you. Please
    feel free to let my manager know what you think of the level of service
    provided. You can send feedback directly to my manager at:
    .

    ==================================================
    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

    Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 2 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions. Issues of this
    nature are best handled working with a dedicated Microsoft Support Engineer
    by contacting Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Allen Chen [MSFT], Jun 9, 2009
    #2
    1. Advertising

  3. Sent the project to your email as provided.
    --
    Thanks again for your help.
    Morris


    "Allen Chen [MSFT]" wrote:

    > Hi Morris,
    >
    > >Is this the correct place to add the script?

    >
    > Please refer to this tutorial:
    >
    > http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/standard/multivi
    > ew.aspx
    >
    > C# source code:
    >
    > http://quickstarts.asp.net/QuickStartv20/util/srcview.aspx?path=~/aspnet/sam
    > ples/ctrlref/standard/MultiView/MultiView1.src&file=multiview1_cs.aspx&lang=
    > C%23+Source
    >
    > >Why is ShowView2 in the script made into a link?

    >
    > Could you clarify what do you mean by "made into a link"? You can send me a
    > demo to clarify the problem. My email is update
    > here after sending the project in case I missed that email.
    >
    > >Can I use expression web 2 for .net commands?

    >
    > Expression Web 2 can be used to edit aspx files. We can use it to edit the
    > style of ASP.NET controls. This tool is mainly used by web site designers.
    > If you want to add code logic you can do that in Visual Studio since it's
    > web site developers' work.
    >
    > >How can I use silverlight2 commands in this expression web2 project?

    >
    > You cannot use Expression Web to code/style Silverlight application. Visual
    > Studio is the IDE for coding and Expression Blend & Expression Designer is
    > the tool to style Silverlight application.
    >
    > If you have additional questions please feel free to ask.
    >
    > Regards,
    > Allen Chen
    > Microsoft Online Support
    >
    > Delighting our customers is our #1 priority. We welcome your comments and
    > suggestions about how we can improve the support we provide to you. Please
    > feel free to let my manager know what you think of the level of service
    > provided. You can send feedback directly to my manager at:
    > .
    >
    > ==================================================
    > Get notification to my posts through email? Please refer to
    > http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
    >
    > Note: MSDN Managed Newsgroup support offering is for non-urgent issues
    > where an initial response from the community or a Microsoft Support
    > Engineer within 2 business day is acceptable. Please note that each follow
    > up response may take approximately 2 business days as the support
    > professional working with you may need further investigation to reach the
    > most efficient resolution. The offering is not appropriate for situations
    > that require urgent, real-time or phone-based interactions. Issues of this
    > nature are best handled working with a dedicated Microsoft Support Engineer
    > by contacting Microsoft Customer Support Services (CSS) at
    > http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
    > ==================================================
    > This posting is provided "AS IS" with no warranties, and confers no rights.
    >
    >
    >
    >
    >
     
    Morris Neuman, Jun 11, 2009
    #3
  4. Hi Morris,

    >Sent the project to your email as provided.


    Thanks for your project. You can try following ways to fix exception.

    1. You've specified the click event handler for Button1:
    <asp:Button runat="server" Text="Overview"
    id="Button1" OnClick="ShowView1"></asp:Button>

    However, there's no definition of ShowView1 in your code. Please add it.
    Another issue is the index. The index is start from 0 so set index to 0
    means to set the first view active.

    <script runat="server">

    protected void ShowView2(object sender, EventArgs e)
    {
    MultiView1.ActiveViewIndex = 1;
    }
    protected void ShowView1(object sender, EventArgs e)
    {
    MultiView1.ActiveViewIndex = 0;
    }

    </script>

    2. ASP.NET needs a form tag set as runat="server" to enclose server
    controls for them to work properly. Please add the tag as below:
    <form id="form1" runat="server">
    <div id="main">
    ...
    </div>
    </form>

    I've emailed the updated index.aspx to you. You can use it to test
    directly. If you have additional questions please don't hesitate to let me
    know.


    Regards,
    Allen Chen
    Microsoft Online Support
     
    Allen Chen [MSFT], Jun 12, 2009
    #4
  5. Thank you Allen. It worked.

    Just 2 questions:

    I am working on the project using Expression Web 2. When I open the
    site_flash/index.aspx page,
    - I get a red line under the <script in statement <script runat="server">
    - The ShowView2 in the statement protected void ShowView2(object sender,
    EventArgs e) shows as a hyperlink.

    Is there a difference in how scripts are handled in Expression Web 2 from
    Visual Studio?

    --
    Thanks once again for your help.
    Morris


    "Allen Chen [MSFT]" wrote:

    > Hi Morris,
    >
    > >Sent the project to your email as provided.

    >
    > Thanks for your project. You can try following ways to fix exception.
    >
    > 1. You've specified the click event handler for Button1:
    > <asp:Button runat="server" Text="Overview"
    > id="Button1" OnClick="ShowView1"></asp:Button>
    >
    > However, there's no definition of ShowView1 in your code. Please add it.
    > Another issue is the index. The index is start from 0 so set index to 0
    > means to set the first view active.
    >
    > <script runat="server">
    >
    > protected void ShowView2(object sender, EventArgs e)
    > {
    > MultiView1.ActiveViewIndex = 1;
    > }
    > protected void ShowView1(object sender, EventArgs e)
    > {
    > MultiView1.ActiveViewIndex = 0;
    > }
    >
    > </script>
    >
    > 2. ASP.NET needs a form tag set as runat="server" to enclose server
    > controls for them to work properly. Please add the tag as below:
    > <form id="form1" runat="server">
    > <div id="main">
    > ...
    > </div>
    > </form>
    >
    > I've emailed the updated index.aspx to you. You can use it to test
    > directly. If you have additional questions please don't hesitate to let me
    > know.
    >
    >
    > Regards,
    > Allen Chen
    > Microsoft Online Support
    >
    >
     
    Morris Neuman, Jun 13, 2009
    #5
  6. Hi Morris,

    >Just 2 questions:


    >I am working on the project using Expression Web 2. When I open the
    >site_flash/index.aspx page,
    >- I get a red line under the <script in statement <script runat="server">
    >- The ShowView2 in the statement protected void ShowView2(object

    sender,
    >EventArgs e) shows as a hyperlink.


    >Is there a difference in how scripts are handled in Expression Web 2 from
    >Visual Studio?


    Yes Expression Web is designers oriented while Visual Studio is programmers
    oriented. You can just ignore the red line and hyperlink caused by the
    inline code. It's not an error but cannot be correctly recognized by
    current Expression Web. If you're a designer you don't care about it. If
    you're a developer you know it's the correct syntax. (Personally I suggest
    you use code behind instead of inline code so that you will not confuse
    designers by this kind of issues)

    Regards,
    Allen Chen
    Microsoft Online Support
     
    Allen Chen [MSFT], Jun 15, 2009
    #6
  7. Thanks Allen.
    --

    Morris


    "Allen Chen [MSFT]" wrote:

    > Hi Morris,
    >
    > >Just 2 questions:

    >
    > >I am working on the project using Expression Web 2. When I open the
    > >site_flash/index.aspx page,
    > >- I get a red line under the <script in statement <script runat="server">
    > >- The ShowView2 in the statement protected void ShowView2(object

    > sender,
    > >EventArgs e) shows as a hyperlink.

    >
    > >Is there a difference in how scripts are handled in Expression Web 2 from
    > >Visual Studio?

    >
    > Yes Expression Web is designers oriented while Visual Studio is programmers
    > oriented. You can just ignore the red line and hyperlink caused by the
    > inline code. It's not an error but cannot be correctly recognized by
    > current Expression Web. If you're a designer you don't care about it. If
    > you're a developer you know it's the correct syntax. (Personally I suggest
    > you use code behind instead of inline code so that you will not confuse
    > designers by this kind of issues)
    >
    > Regards,
    > Allen Chen
    > Microsoft Online Support
    >
    >
     
    Morris Neuman, Jun 15, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Spam Survivor
    Replies:
    3
    Views:
    514
    Nick Kew
    Sep 15, 2003
  2. chuck
    Replies:
    1
    Views:
    603
    Martin Honnen
    Jul 4, 2004
  3. Jan Danielsson
    Replies:
    8
    Views:
    647
    Mike Meyer
    Jul 22, 2005
  4. Jp Calderone
    Replies:
    0
    Views:
    467
    Jp Calderone
    Jul 21, 2005
  5. davidj411
    Replies:
    0
    Views:
    554
    davidj411
    Jun 27, 2008
Loading...

Share This Page