Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Integrating scripts with html

Reply
Thread Tools

Integrating scripts with html

 
 
Morris Neuman
Guest
Posts: n/a
 
      06-08-2009
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
 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      06-09-2009
Hi Morris,

>Is this the correct place to add the script?


Please refer to this tutorial:

http://quickstarts.asp.net/QuickStar...andard/multivi
ew.aspx

C# source code:

http://quickstarts.asp.net/QuickStar...h=~/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 http://www.velocityreviews.com/forums/(E-Mail 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 Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#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/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.




 
Reply With Quote
 
 
 
 
Morris Neuman
Guest
Posts: n/a
 
      06-11-2009
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/QuickStar...andard/multivi
> ew.aspx
>
> C# source code:
>
> http://quickstarts.asp.net/QuickStar...h=~/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 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 Removed).
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/en-us/subs...#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/subs.../aa948874.aspx
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
>
>
>

 
Reply With Quote
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      06-12-2009
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

 
Reply With Quote
 
Morris Neuman
Guest
Posts: n/a
 
      06-13-2009
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
>
>

 
Reply With Quote
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      06-15-2009
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

 
Reply With Quote
 
Morris Neuman
Guest
Posts: n/a
 
      06-15-2009
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
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Python Scripts with IIS - ASP or Python-based CGI scripts withIIS - which makes more sense? davidj411 Python 0 06-27-2008 04:38 PM
Stupid question: Making scripts python-scripts Jan Danielsson Python 8 07-22-2005 12:20 AM
Re: Stupid question: Making scripts python-scripts Jp Calderone Python 0 07-21-2005 02:38 PM
Help with integrating xml into html chuck XML 1 07-04-2004 10:34 AM
Integrating xhtml/html validation into a web-based CMS(MS-windows) Spam Survivor XML 3 09-15-2003 06:29 PM



Advertisments