Jump to content

fvincentis

Members
  • Posts

    2
  • Joined

  • Last visited

fvincentis's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Ah, good to know. I just gave it a go, but it seems if I use the HTML controls instead of the .NET controls, I cannot directly modify the properties of the elements anymore. Let's take the next code as an example:<script runat="server">Sub submit(sender As Object, e As EventArgs)lbl1.Text="Your name is " & txt1.TextEnd Sub</script><html><body><form runat="server">Enter your name:<asp:TextBox id="txt1" runat="server" /><asp:Button OnClick="submit" Text="Submit" runat="server" /><p><asp:Label id="lbl1" runat="server" /></p></form></body></html> The above script prints out a label after I enter content into the textbox. This is what I really like so far about ASP.NET, but it doesn't work with the following code: <script runat="server">Sub submit(sender As Object, e As EventArgs)lbl1.Text="Your name is " & txt1.TextEnd Sub</script><html><body><form runat="server">Enter your name:<input type="text" id="txt1" runat="server"/><asp:Button OnClick="submit" Text="Submit" runat="server" /><p><asp:Label id="lbl1" runat="server" /></p></form></body></html> Sooo... I guess this means if I use HTML controls I cannot talk to the control attributes as I would be able to do if they were .NET controls, right? Doesn't that defeat the advantage of .NET over other languages? Sorry, as you can take I am really new to this language - I am still trying to understand what the advantage of .NET is over PHP or regular ASP.
  2. Hi guys,I just had a first look at ASP.NET and I quite like the way it works. However, I am a bit annoyed by the HTML that the Web Controls create automatically for me.An example:<form runat="server"><asp:RadioButtonList id="countrylist" runat="server" class="andreas"><asp:ListItem value="N" text="Norway" /><asp:ListItem value="S" text="Sweden" /></asp:RadioButtonList></form>The code above creates a lot of HTML that in my opinion is unnecessary. The result source code looks something like this:<form name="_ctl0" method="post" action="index.aspx" id="_ctl0"><input type="hidden" name="__VIEWSTATE" value="dDwtMTk3NTMzNTYxMDs7PhRKws7MrkiprJLJqu4rbrdBhNoQ" /><table id="countrylist" class="andreas" border="0"><tr><td><input id="countrylist_0" type="radio" name="countrylist" value="N" /><label for="countrylist_0">Norway</label></td></tr><tr><td><input id="countrylist_1" type="radio" name="countrylist" value="S" /><label for="countrylist_1">Sweden</label></td></tr></table></form>I would liv to get rid of the table that is being created automatically. All I want is the label and the input for each radio button. The rest I want to do with CSS myself.So I was wondering if there is any way to change the HTML that is being created? Can I prevent .NET from creating unnecessary tables like the one above?Thanks for the help.
×
×
  • Create New...