Datalist, detailsview
Datalist, detailsview
Datalist, detailsview
Datalist, detailsview
Datalist, detailsview
Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview
Datalist, detailsview Datalist, detailsview
Datalist, detailsview
Go Back  Xtreme Visual Basic Talk > > > Datalist, detailsview


Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2007, 01:22 AM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default Datalist, detailsview


ok...here's the deal....im doing a project of a website selling dvds kinda like amazon.com....now doing the main page where user can view and search titles...able to search records and display results in datalist....now trying to get that title displayed in search result to link to a detailsview showing details of that movie....
for example in amazon.com when u search a title the results display and user can click the title and another page will display the details of that movie...so how do i get the title link in search result to display a detailsview of that title???.....(pls dont refer me to some code site or forum).....
Reply With Quote
  #2  
Old 06-30-2007, 01:40 AM
A-Dam A-Dam is offline
Junior Contributor
 
Join Date: Nov 2002
Posts: 361
Default

To show the details in another page, you'll need to have separate details web pages created for each title, and return links with <a> tags. In your table with the titles, you can have text fields (like varchar) with links formed from the titles. So for Cool Hand Luke, you have:

<a href="Cool Hand Luke.html" target="_blank">Cool Hand Luke</a>

Since controls like a datagrid and datalist actually return the html to form a web page table, these will create hyperlinks in the client browser.

That's just a simple example. Of course, you'll have to do a bit a string manipulation, and have the details pages made up. I would probably use an ID field instead of the title to name my details pages. Names like 0091_detail.html and 2311_detail.html would be easier to manage for movies with long titles.
That should get you started.
__________________
It looks like ketchup; it tastes like ketchup; but brother, it ain't ketchup!
Reply With Quote
  #3  
Old 07-01-2007, 07:24 AM
DooH's Avatar
DooH DooH is offline
Centurion
 
Join Date: Oct 2003
Location: Barcelona
Posts: 139
Thumbs up

A-Dam

You can do the follow:

result.aspx (this page, store a gridview with the search result, in that gridview, you have to add a hyperlinkfield template. you have to configure this properties:

DataNavigateUrlField (example: dvd_id)
DataNavigateUrlFormatString (example: show.aspx?dvd_id={0})
DataTextField (example: dvd_id)

show.aspx (this page store the detailsview that load the data using the value in the querystring: dvd_id

Regards.
__________________
make it simple.
Reply With Quote
  #4  
Old 07-01-2007, 11:50 AM
A-Dam A-Dam is offline
Junior Contributor
 
Join Date: Nov 2002
Posts: 361
Default

Yes, you can do it that way. Create the template and set the properties. I prefer the idea of having the <a> links stored as text in the database; either in the same dvd table or a separate links table.
I suppose there are benefits to using the HyperLinkColumn, but I haven't really seen any.
__________________
It looks like ketchup; it tastes like ketchup; but brother, it ain't ketchup!
Reply With Quote
  #5  
Old 07-01-2007, 04:49 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

For one thing, data entry will be straightforward. And you would not need any additional rules or coding in entering product info.

using the hyperlink column:
You do not need to type <a> when encoding a new item/product

not using the hyperlink column:
you will either need to manually type in <a> per item or code it so that when the user hits Save, your app adds the <a> tags.

I hope this helps.


BTW
Welcome to the forums Shah_Rizal!
__________________
Pinoy ako.. ipinagmamalaki ko.

Last edited by Eduardo Lorenzo; 07-01-2007 at 09:03 PM.
Reply With Quote
  #6  
Old 07-01-2007, 07:59 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

ok...so i will need another page with the detailsview to load the data using the id and another page with a gridview to display search results....(actually im already using datalist to display results...but nvm)....so i take it no datasource for the gridview or detailsview??
Reply With Quote
  #7  
Old 07-01-2007, 09:07 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

My vote would go to:

DataRepeater for the main page or Gridview that includes a product ID of some sort.
DetailsPage for the product details which waits for the productID sent by the main page as part of the url(querystring).

This way, you need to construct only one page for the product details and just render the page according to the product/DVD based on the ProductID.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #8  
Old 07-02-2007, 01:23 AM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

ok...so i've decided to stick with a datalist in the main page to display the results...and another page for the detailsview. i displayed the title as a linkbutton so that when clicked will display the detailsview page....
so in the asp source the text for the title would be something like this?...

<a href= "details.aspxMovie_ID =<%# Eval( "Movie_ID" ) %>' <%# Eval("Title") %>

how about the detailsview....do i need to change anything in the properties ?/

Last edited by shah_rizal; 07-02-2007 at 01:41 AM.
Reply With Quote
  #9  
Old 07-02-2007, 01:55 AM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

you will if you need to add functionality like a shopping cart or something.
There are a myriad of items that you can add. If I understand it correctly your site is an e-commerce site and the point is to sell DVDs?

I think you should stand-back a couple of feet from the project and plan the site thoroughly by studying other selling sites (like amazon or other sites that sells) and try to incorporate their techniques in your site.

Good luck.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #10  
Old 07-03-2007, 09:21 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

ok...so here's the text for the title linkbutton....its supposed to send the Movie_ID to details.aspx page....i dont think i can get it..
Code:
Text='<a href= "Details.aspx?Movie_ID ="<%# Eval("Movie ID") %>'> <%# Eval("Title") %> </a>
and how do i request.querystring the Movie_ID in the details.aspx page_load?
Reply With Quote
  #11  
Old 07-03-2007, 09:36 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

in details.aspx page...

TextBox1.Text = Request.QueryString["Movie_ID"];
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #12  
Old 07-03-2007, 10:19 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

its not a textbox....im using a detailsview control....and i dont think i can get that Movie_ID in the first place....ive tested it using a label and did
label1.text = request.querystring("Movie_ID")
it doesnt display....
Reply With Quote
  #13  
Old 07-03-2007, 10:25 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

could you check the url when it goes to details.aspx and paste it here for me?

should look like:

http://localhost/yoursite....somethin' somethin'
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #14  
Old 07-03-2007, 11:20 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

Reply With Quote
  #15  
Old 07-04-2007, 01:00 AM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

there is no value? then this

<a href= "Details.aspx?Movie_ID ="<%# Eval("Movie ID") %>'> <%# Eval("Title") %> </a>

did not pass the value to Movie_ID.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #16  
Old 07-04-2007, 02:26 AM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

yeah i thought so...something wrong with that....for all records its the same url....btw is it bcos my Movie_ID is alphanumeric?..eg MV0001...?? does it have to be numeric only?
Reply With Quote
  #17  
Old 07-04-2007, 05:48 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

well you will be passing it as a string. Just check your syntax, the passed url should look something like

http://localhost:3360/Details.aspx?Movie_ID=12345
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #18  
Old 07-04-2007, 07:18 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

yeah...thanks....finally got it...used hyperlink
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Title") %>' NavigateUrl='<%# Eval("Movie ID","Details.aspx?Movie_ID={0}") %>'> ></asp:HyperLink>
next problem is getting that movie details into a detailsview control in the details page....
did this
Code:
If (Request.QueryString("Movie_ID") IsNot Nothing) Then
            Try
                Dim ID As String
                If (Request.QueryString("Movie_ID") IsNot Nothing) Then
                    ID = Request.QueryString("Movie_ID")
                    strSQL = "SELECT * FROM Dvd_details WHERE Movie_ID = @Movie_ID "
                    Dim dtRecord As New OleDb.OleDbDataAdapter(strSQL, conn)
                    dtRecord.SelectCommand.CommandType = CommandType.Text

                    conn.Open()
                    Dim dsView As New DataSet
                    dtRecord.Fill(dsView)
                    Me.DetailsView1.Visible = True
                    Me.DetailsView1.DataSource = dsView
                    Me.DetailsView1.DataBind()
                    conn.Close()

                End If

            Catch ex As Exception
            End Try

        End If
nothing displayed
Reply With Quote
  #19  
Old 07-04-2007, 07:35 PM
Eduardo Lorenzo's Avatar
Eduardo Lorenzo Eduardo Lorenzo is offline
Senior Contributor
 
Join Date: Jun 2006
Location: Manila, Philippines
Posts: 846
Default

your SQL statement is hardcoded. Are you using a stored procedure for this? Try passing the VALUE of the variable ID instead of the string "@Movie_ID"

Code:
"Select * from Dvd_details WHERE Movie_ID = " & ID

also, do try to avoid using "Select *" as much as possible as it will give negative performance results. Try to itemize specific fields as much as possible. Benefits are:
1. You can choose which fields are to be shown
2. You can actually set how the fields are to be displayed
(Select Movie_ID, Title, Director, Date) and not have display just as-is from the database.
__________________
Pinoy ako.. ipinagmamalaki ko.
Reply With Quote
  #20  
Old 07-04-2007, 07:58 PM
shah_rizal's Avatar
shah_rizal shah_rizal is offline
Newcomer
 
Join Date: Jun 2007
Location: Singapore
Posts: 20
Default

yeah ive tried that already..
strSQL = "SELECT * FROM Dvd_details WHERE Movie_ID =" + ID
nothing displayed....blank page...anyway what is a stored procedure??
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Datalist, detailsview
Datalist, detailsview
Datalist, detailsview Datalist, detailsview
Datalist, detailsview
Datalist, detailsview
Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview Datalist, detailsview
Datalist, detailsview
Datalist, detailsview
 
Datalist, detailsview
Datalist, detailsview
 
-->