Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. best way of showing single record

best way of showing single record

Scheduled Pinned Locked Moved ASP.NET
questionhtmldatabasediscussion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hanzaplast
    wrote on last edited by
    #1

    hi what is best practice for showing single record from DataSource controls (SqlDataSource, AccessDataSource, ...) this is quite common situation; lets say i need to show simple data from database based on id that is passed via querystring using repeater for only one record feels wrong?

        <%#Eval("Name") %>
          
        
    
            <%#Eval("HTML") %>
    

    <%=DetailHTML() %>

    <SelectParameters>
        </SelectParameters>
    
    R Z 2 Replies Last reply
    0
    • H Hanzaplast

      hi what is best practice for showing single record from DataSource controls (SqlDataSource, AccessDataSource, ...) this is quite common situation; lets say i need to show simple data from database based on id that is passed via querystring using repeater for only one record feels wrong?

          <%#Eval("Name") %>
            
          
      
              <%#Eval("HTML") %>
      

      <%=DetailHTML() %>

      <SelectParameters>
          </SelectParameters>
      
      R Offline
      R Offline
      R Giskard Reventlov
      wrote on last edited by
      #2

      I would be inclined to create a suitable control on the form and then populate it from code behind. That way you can render the control with any styles, etc, ready to accept the value. Perhaps like:

      In the OnLoad event (or wherever you deem appropriate):

      if (!IsPostBack)
      {
      result = GetStringValueFromDatabase(Parameter);
      Label1.Text = result;
      }

      or similar.,

      "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

      1 Reply Last reply
      0
      • H Hanzaplast

        hi what is best practice for showing single record from DataSource controls (SqlDataSource, AccessDataSource, ...) this is quite common situation; lets say i need to show simple data from database based on id that is passed via querystring using repeater for only one record feels wrong?

            <%#Eval("Name") %>
              
            
        
                <%#Eval("HTML") %>
        

        <%=DetailHTML() %>

        <SelectParameters>
            </SelectParameters>
        
        Z Offline
        Z Offline
        ZurdoDev
        wrote on last edited by
        #3

        It really is up to you. You can use a grid view, a datalist, textboxes, labels, etc. It all depends.

        There are only 10 types of people in the world, those who understand binary and those who don't.

        H 1 Reply Last reply
        0
        • Z ZurdoDev

          It really is up to you. You can use a grid view, a datalist, textboxes, labels, etc. It all depends.

          There are only 10 types of people in the world, those who understand binary and those who don't.

          H Offline
          H Offline
          Hanzaplast
          wrote on last edited by
          #4

          ye, i know... i need to develop master page for portal that has content like this: //////////////////////////// //div // //Check our latest product! //////////////////////////// //////////////////////////// //div // //Pool: What do you think? //1. //2. //3. //////////////////////////// //////////////////////////// //div // //TOP 1 video //////////////////////////// //////////////////////////// //div // //Latest client activites //////////////////////////// ...many more so i have plenty of "single record" DataSources (queries like "select something from myTable where id=1") the way i did this is: //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// but using x repeaters for x "single record" DataSoruces feels wrong. so i am just wondering is this approach ok?

          Z 1 Reply Last reply
          0
          • H Hanzaplast

            ye, i know... i need to develop master page for portal that has content like this: //////////////////////////// //div // //Check our latest product! //////////////////////////// //////////////////////////// //div // //Pool: What do you think? //1. //2. //3. //////////////////////////// //////////////////////////// //div // //TOP 1 video //////////////////////////// //////////////////////////// //div // //Latest client activites //////////////////////////// ...many more so i have plenty of "single record" DataSources (queries like "select something from myTable where id=1") the way i did this is: //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// //////////////////////////// //div // // //////////////////////////// but using x repeaters for x "single record" DataSoruces feels wrong. so i am just wondering is this approach ok?

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #5

            It isn't wrong because it allows for future flexibility but you may want to create a user control for each of those items and just use labels and textboxes or whatever you want in the control. Then just add as many of the usercontrols onto your page. That may make management of it easier.

            There are only 10 types of people in the world, those who understand binary and those who don't.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups