Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
| Search | Today's Posts | Mark Forums Read
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2004, 06:32 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default HTML Control "select" runat="server"

I have a problem in running the following code:

<html>
<head>
</head>
<body>
    <form runat="server">
        <select style="WIDTH: 219px" runat=”server”>
        <option>a</option>
        <option selected="selected">b</option>
        <option>c</option>
        </select>

    </form>
</body>
</html>

If the Select tag is not runat="server", then it's OK, but when the object is parsed by asp.net the tag <Option Selected="selected"> generates error, but <option selected> is OK and accepted by parser. However webmatrix replaces <option selected> by <option selected="selected"> when you go to design view of the page, forcing the error.

Is there any help in this issue for me? Is the above text descriptive enough?
 
Old October 13th, 2004, 07:53 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

I noticed that you don't have an ID for the select. This may be an issue. Add an ID, and see if that clears it up.

Brian
 
Old October 13th, 2004, 08:34 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you Brian for your reply.
I added ID, but no difference. As you know selected="selected" is valid in XHTML and so it is working quite well without runat="server" option of the select tag. However it is not accepted by the asp.net parser, (it expects a value of true/false ,just Boolean), and causes error when runat="server" is added to the tag. Now the question is:
1. Why webmatrix changes the code (from <option Selected> to <option selected=”selected”) when visiting the design view of page?
2. Is there any setting to change this feature of webmatrix?
3. How parser/compiler can be configured to accept the above synax?

Regards
hamid


 
Old October 13th, 2004, 09:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You could try the server control equivalent, the <asp:DropDownList>. It's pretty much the same.

Brian




Similar Threads
Thread Thread Starter Forum Replies Last Post
Runat server dilemma ? rsearing ASP.NET 2.0 Basics 1 November 24th, 2006 04:10 AM
Converting an HTML Server Control to HTML Control gratisaccount ASP.NET 1.0 and 1.1 Basics 2 August 7th, 2006 12:29 AM
<form runat="server"> gopi2008 ASP.NET 1.0 and 1.1 Basics 3 May 21st, 2006 11:07 PM
html:select aytacakin Pro JSP 0 November 15th, 2005 04:58 AM
Runat = Server Lorzendo ASP.NET 1.0 and 1.1 Basics 1 November 12th, 2004 12:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.