views:

245

answers:

2

By default the FormView control creates html like :

ID <asp:TextBox ID="IdTextBox" runat="server" Text='<%# Eval("ID") %>' />
<br />
Name <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Eval("Name") />

I prefer:

<ol class="form-layout">
  <li><asp:Label AssociatedControl="IdTextBox" runat="server">ID:</aspLabel><asp
  ....
</ol>

My plan is to create a new control ( OrderedListFormView ) that inherits the FormView and overrides the method that generates the default "crap" html. I have been unable to find the method. Can anyone help? Do you have a better solution that costs $0 dollars?

I would prefer to change the default behavior at design time.

+1  A: 

You sound like you have the ASP.NET form blues. Have you tried ASP.NET MVC? It gives you far better control of your rendered HTML, and you can mix it in with existing ASP.NET applications.

Robert Harvey
Not what I initially wanted. Piss on it. This saved more time in long run.
dr
+1  A: 

Try using Control Adapters to change the rendered HTML from a FormView, there is a tool kit and are pretty easy to code

http://weblogs.asp.net/scottgu/archive/2006/09/08/CSS-Control-Adapter-Toolkit-Update.aspx

http://msdn.microsoft.com/en-us/magazine/cc163543.aspx

Jon
I would like to change behavior at design time.
dr
At design time you don't see the rendered HTML of the formview unless you run and when that is done the control adapter will kick in altering the rendered html
Jon