Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 346497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:10:57+00:00 2026-05-12T11:10:57+00:00

Does anyone have any tricks for quickly laying out the asp.net html markup for

  • 0

Does anyone have any tricks for quickly laying out the asp.net html markup for a specific database table?

For example, say I have a table “Company”, and I just want to render a textbox for all the columns.

One trick that I thought I saw and confirmed to work was to do some markup like so:

<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>
<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>
<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>
<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>
<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>
<p><label for="zzzz">zzzz</label><asp:TextBox ID="zzzz" Text='<%# Bind("zzzz")%>' runat="server" /></p>

Basically, one per row in your database table.

Then, select (in SQL Server):

select * from INFORMATION_SCHEMA.COLUMNS where table_name = 'Company'

Highlight the COLUMN_NAME column in the resulting output and copy to clipboard.

Then, using the ALT+drag trick to highlight a vertical column, highlight the zzzz’s in your markup (starting from the right so things keep lining up), and paste the column names over top. I swear I saw this done in a video, and I tried it myself and it worked, but tonight I can’t seem to make it work.

Of course, an even better way to do this would be through T4 or some kind of code generation like that, and just have every table render default html into a folder such as \CodeGen\EditForms where you could copy and paste from, but for that I don’t know where to start.

Update

Sure enough I figure the copy paste thing out as soon as I post a question.
The trick is to paste from SSMS into Visual Studio, then select the column names using the ALT+drag, then you can paste over top of the zzzz’s.

So I guess that is solved. I would really love to see an example of how something better could be done with T4 though.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:10:57+00:00Added an answer on May 12, 2026 at 11:10 am

    There is a nice "How Do I: Create And Use T4 Templates?" video on the MSDN site which covers the use of T4 generally, and includes a specific example which covers the use of classes within the Microsoft.SqlServer.Management.SMO namespace to generate a class corresponding each table in a database, with a property generated per table column in each class.

    Note that the video is 25 minutes long, and the bit that you’re particularly interested in (generating code from a database schema) starts around 14 minutes in. If you’re new to T4, though, it’s well worth watching from the start: for example, you’ll probably want to learn how to specify the output file type as ".aspx", and this is covered near the beginning.

    With relatively small modifications to the code shown in this video, you should be able to use T4 to generate the aspx code you’re interested in.

    Props to Hilton Giesenow for creating such a useful video. Happy generating!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have any tips or gotcha moments to look out for when trying
Does anyone have any techniques/tips/tricks to help me organize and implement multiple jQuery UI
Does anyone have any recommendations of tools that can be of assistance with moving
Does anyone have any experience getting MSTest to copy hibernate.cfg.xml properly to the output
Does anyone have any practical suggestions about how to manage feature creep in GUIs?
Does anyone have any suggestions on how to mentor a junior programmer ? If
Does anyone have any tips for dealing with ConstraintExceptions thrown by XSD datasets? This
Does anyone have any good starting points for me when looking at making web
Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using
Does anyone have any experience with how well web services build with Microsoft's WCF

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.