This should probably be an easy question for most of you. I'm brand new to .net but not to asp.

Backend - SQL2000
Language = VB

I'm doing your basic Search - View Search Results / use hyperlink to view the details of a single record so that I can update said record.

I'll describe it in a 3 file approach:
search.aspx - > SearchResults.aspx (many records) -> Record Detail.aspx (retrieved via hyperlink on SearchResults.aspx)

The problem I'm having is that every example I've read or watched for this type of Update uses a Grid View or DetailsView grid and I don't want to be stuck in a grid. I want to have control over where I place textboxes, dropdowns, checkboxes etc... I would like absolute control if possible. I was able to do this in .asp with tables etc...

What is the best method for displaying record Details (1 record in view) in a way which I can have some control on how they are displayed? For example, I don't want any of the template / grid style views.

Can anyone point me to an example or a method for displaying the cell information in a way which I can manipulate the placement of my fields?

I know, probably a very easy answer, but I just haven't come across it!

Dave

Recommended Answers

All 4 Replies

actually, you are almost forced to use them. But I like to stay away from GridView and DataSet. Use a DataList. Basically, just create the page you want to and bind your data to the DataList, then just add the datalist tags above and below the beggining and end of your code. Since you only have one record showing, you have no worries about repeating to break your code. Just make sure you only have one record showing! Otherwise, one of the crappiest ways to do it is bind them all to labels and literals. Labels put everthing targeted to the label in a <div> label info </div> tag. Literals just output the information. Depending on how much information you have, just use ExecuteScalar() to retrieve your record and set it equal to a string, then bind the string to the Literal/Label.

strOutputInfo = commandSelectInfo.ExecuteScalar()
labelnameorliteralname.Text = strOutputInfo & "your other info here"

Else, just create your page and try to put all your data in a table, regardless of how many tables inside that table they exist. (This prevents breaking code incase of errors). THen just put your code like this:

<asp:Datalist ID="dlOutputInfo" runat="server">
<ItemTemplate>
<table>
  <tr>
    <td>......<%# DataBinder.Eval(Container.DataItem, strOutputInfo) %>......</td>
  </tr>
</table>
</ItemTemplate>
</asp:Datalist>

Your best bet is to retrieve all the info in one SQL query if possible and just using one datalist near the begining and end it near the end of the page. Then just fill in the DataItems.

I can help, but you need to post your code, otherwise I am throwing bricks in a pond trying to knock out a fish.

Thanks you ShesA!

I'll give this a try today. I thought I was the only person in the universe who was feeling trapped by the grids. They are just not efficient in use of space and layout. It's good to know someone else is thinking outside of the grid ;-)

I'll get back with an update.

dave

can anyone help me.. i have a problem regarding my website i created a login page but then when a user login to see his/her profile the details view only shows the first record in the database? how can the details view show the profile of the person who login in a details view?

This will be done through your query language, not ASP.NET. However, go ahead and post your query / code and I'll see what I can do to help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.