Passing Selected Data to another .aspx Pages

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 6
Reputation: komodo891 is an unknown quantity at this point 
Solved Threads: 0
komodo891 komodo891 is offline Offline
Newbie Poster

Passing Selected Data to another .aspx Pages

 
0
  #1
May 27th, 2008
Here is my problem...

I am developing a portion of my website to sell my floor plans online. I have an access database linked to a Datalist that displays a thumbnail elevation and some basic info about that plan. What I am having problems with is once a person clicks a thumbnail elevation that they like I want it to pop up on another page with a larger elevation image, the actual floor plan and all the detailed information about the plan, which is all stored in the same database. How do I pass that one entry in the database to carry over to another page and display. I know I am probably making this a lot harder then it actaully is!

I am using Expression Web 2 and Visual Web Studio Express.

Any help would be greatly appreciated!
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 125
Reputation: bala24 is an unknown quantity at this point 
Solved Threads: 11
bala24's Avatar
bala24 bala24 is offline Offline
Junior Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #2
May 28th, 2008
That would depend upon if you have a unique value representing the thumbnail elevation in question.

What you could do is , on the selection of the thumbnail pass this unique value as a query string or a session variable to the pop-up page and let the page load event retrieve the rest of the info for you to be rendered on this page.

I hope this is what you need.
Let me know in case of any doubts.
Michelangelo

"The best place to find a helping hand is at the end of your own arm"
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: komodo891 is an unknown quantity at this point 
Solved Threads: 0
komodo891 komodo891 is offline Offline
Newbie Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #3
May 28th, 2008
I may have undertaken a task that is far beyond my programming ability but I think I am going in the right direction now. I am still having some problems with the logic (Which I feel like I am out of).
1. I create a script for the "Button_Click" in "planlist.aspx"
  1. Sub Plan_Click(ByVal Sender As Object, ByVal e As EventArgs)
  2. Session("DataListCopy") = Datalist1.??? \\ Not sure what to use here to copy the whole datalist.
  3. End Sub

2. Then when I post it to the next page "plandetail.aspx"
[code]
sub Page_Load(obj as object, e as eventArgs)
\\How do I tell the Formview to use that session?
[\code]

Any help or direction would be very helpful.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 163
Reputation: rajarajan07 is on a distinguished road 
Solved Threads: 23
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Junior Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #4
May 29th, 2008
Hi,

I think u can use the query string to pass values from one page to another page. Please look into the coding below as an example and you implement this in your situation, it will work.

Here we having a listbox and a checkbox (to select mode)

  1. Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
  2. ' Add sample values.
  3. lstItems.Items.Add("Econo Sofa")
  4. lstItems.Items.Add("Supreme Leather Drapery")
  5. lstItems.Items.Add("Threadbare Carpet")
  6. lstItems.Items.Add("Antique Lamp")
  7. lstItems.Items.Add("Retro-Finish Jacuzzi")
  8. End Sub
  9.  
  10. Private Sub cmdGo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdGo.Click
  11. Dim Url As String = "QueryStringRecipient.aspx?"
  12. Url &= "Item=" & lstItems.SelectedItem.Text & "&"
  13. Url &= "Mode=" & chkDetails.Checked.ToString()
  14. Response.Redirect(Url)
  15. End If
  16. End Sub
  17.  

[code]
QueryStringReceipient.aspx
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
lblInfo.Text = "Item: " & Request.QueryString("Item") & "<br>"
lblInfo.Text &= "Show Full Record: " & Request.QueryString("Mode")
End Sub
[code]

Sure it will work and If it works add to my reputation and mark it as solved.
Thanks & Regards,
RajaRajan. R

trulyraja2009@yahoo.in
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: komodo891 is an unknown quantity at this point 
Solved Threads: 0
komodo891 komodo891 is offline Offline
Newbie Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #5
Jun 3rd, 2008
Your code above helped. Thanks. But now I have a new problem. When my Image Button calls my subroutine "PlanClick" it says that PlanClick is not defined. Why? Am I missing something here? Again, Any help is appreciated!

  1. <%@ Page Language="VB" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDB" %>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <script runat="Server" type="text/VB">
  7. Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
  8. Label1.Text = "This Works"
  9. End Sub
  10. </script>
  11.  
  12. <script runat="server" type="text/VB">
  13. Public Sub PlanClick(ByVal obj As Object, ByVal e As EventArgs)
  14. Response.Redirect("http://www.MyTargetPage.com")
  15. End Sub
  16. </script>
  17.  
  18.  
  19. <html xmlns="http://www.w3.org/1999/xhtml" >
  20. <head runat="server">
  21. <title>Floor Plan Lists</title>
  22. </head>
  23.  
  24. <body>
  25. <form id="form1" method="post" runat="server" >
  26. <div>
  27. <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  28. <asp:Button ID="Button1" runat="server" Text="Button" EnableTheming="False" OnClientClick="PlanClick" />
  29. <asp:DataList ID="DataList1" runat="server" DataKeyField="ID1" DataSourceID="AccessDataSource1"
  30. RepeatColumns="2" RepeatDirection="Horizontal">
  31. <ItemTemplate>
  32. <asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="Submit_Click" /><br />
  33. ID1:
  34. <asp:Label ID="ID1Label" runat="server" Text='<%# Eval("ID1") %>'></asp:Label><br />
  35. PlanNumber:
  36. <asp:Label ID="PlanNumberLabel" runat="server" Text='<%# Eval("PlanNumber") %>'></asp:Label><br />
  37. </ItemTemplate>
  38. </asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Plans/floorplans.mdb"
  39. SelectCommand="SELECT * FROM [tblFPInfo]"></asp:AccessDataSource>
  40.  
  41. </div>
  42. </form>
  43. </body>
  44. </html>
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: komodo891 is an unknown quantity at this point 
Solved Threads: 0
komodo891 komodo891 is offline Offline
Newbie Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #6
Jun 3rd, 2008
I accidently was calling the wrong sub name but even after I fixed it I still get the same error message. Error: 'Submit_Click" is not defined. I know it is! What am I doing wrong?
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 163
Reputation: rajarajan07 is on a distinguished road 
Solved Threads: 23
rajarajan07's Avatar
rajarajan07 rajarajan07 is offline Offline
Junior Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #7
Jun 3rd, 2008
In above coding itself, submit_click was missed up. Please check it.
Thanks & Regards,
RajaRajan. R

trulyraja2009@yahoo.in
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 68
Reputation: srikanthkadem is an unknown quantity at this point 
Solved Threads: 11
srikanthkadem srikanthkadem is offline Offline
Junior Poster in Training

Re: Passing Selected Data to another .aspx Pages

 
0
  #8
Jun 3rd, 2008
hi ,
if u r using datalist the child control events will not raised directly.so use itemcommand(bubble event) of datalist to raise image button click event.
below is the eg iam giving hope this will help u....
  1. <asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand">
  2. <ItemTemplate>
  3. <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/progressAnimation.gif" CommandArgument ="uniquecolumn" CommandName ="navigate" />
  4. </ItemTemplate>
  5. </asp:DataList>
  6.  
  7. protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
  8. {
  9. if (e.CommandName = "navigate")
  10. {
  11. string uniquekey = e.CommandArgument.ToString();
  12. //do something if u want
  13. Response.Redirect("~/somepage.aspx?uk=" + uniquekey);
  14. }
  15. }
Last edited by peter_budo; Jun 4th, 2008 at 4:43 am. Reason: Correcting code tags, the closing tag is [/code]
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 6
Reputation: komodo891 is an unknown quantity at this point 
Solved Threads: 0
komodo891 komodo891 is offline Offline
Newbie Poster

Re: Passing Selected Data to another .aspx Pages

 
0
  #9
Jun 3rd, 2008
I appreciate everyones help so far!!! It still isn't not working though. I don't know why it won't call the script from the "OnClientClick". Any help? Anyone? Code Below...

  1. <%@ Page Language="VB" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDB" %>
  4.  
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <script runat="Server" type="text/VB">
  7. Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
  8. Label1.Text = "This WOrks"
  9. End Sub
  10. </script>
  11.  
  12. <script runat="Server" type="text/VB"> ' Script to redirect and post to querystring
  13. Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As DataListCommandEventArgs) Handles DataList1.ItemCommand
  14. If (e.CommandName = "Navigate") Then
  15. Response.Redirect("plandetail.aspx")
  16. End If
  17. End Sub
  18. </script>
  19.  
  20.  
  21. <html xmlns="http://www.w3.org/1999/xhtml" >
  22. <head runat="server">
  23. <title>Untitled Page</title>
  24. </head>
  25.  
  26. <body>
  27. <form id="form1" method="post" runat="server" >
  28. <div>
  29. <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
  30. <asp:Button ID="Button1" runat="server" Text="Button" EnableTheming="False" OnClientClick="DataList1_ItemCommand" />
  31. <asp:DataList ID="DataList1" runat="server" DataKeyField="ID1" DataSourceID="AccessDataSource1"
  32. RepeatColumns="2" RepeatDirection="Horizontal">
  33. <ItemTemplate>
  34. <asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="DataList1_ItemCommand" CommandArgument="PlanNumber" CommandName="navigate" /><br />
  35. ID1:
  36. <asp:Label ID="ID1Label" runat="server" Text='<%# Eval("ID1") %>'></asp:Label><br />
  37. PlanNumber:
  38. <asp:Label ID="PlanNumberLabel" runat="server" Text='<%# Eval("PlanNumber") %>'></asp:Label><br />
  39. </ItemTemplate>
  40. </asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Plans/floorplans.mdb"
  41. SelectCommand="SELECT * FROM [tblFPInfo]"></asp:AccessDataSource>
  42.  
  43. </div>
  44. </form>
  45. </body>
  46. </html>
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 68
Reputation: srikanthkadem is an unknown quantity at this point 
Solved Threads: 11
srikanthkadem srikanthkadem is offline Offline
Junior Poster in Training

Re: Passing Selected Data to another .aspx Pages

 
0
  #10
Jun 4th, 2008
hi,
  1. <asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="DataList1_ItemCommand" CommandArgument="PlanNumber" CommandName="navigate" /><
in this emove on client click it will not work.(i already told u that child control events will not raise)...so use comand name.in server side if command name is navigate means the imgbutton clicked.so do what ever u want..if have any other button or link button then set another command name.to catch that control event.
hope u understood.......
got solution ?, please mark the thread as Solved. Thanks & Regards,
srikanth kadem
srikanthkadem@rediffmail.com
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



Tag cloud for ASP.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC