Integrating scripts with html

M

Morris Neuman

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
 
A

Allen Chen [MSFT]

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 (e-mail address removed) 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:
(e-mail address removed).

==================================================
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.
 
A

Allen Chen [MSFT]

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
 
M

Morris Neuman

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?
 
A

Allen Chen [MSFT]

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
 
M

Morris Neuman

Thanks Allen.
--

Morris


Allen Chen said:
Hi Morris,




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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top