| | |
Passing Selected Data to another .aspx Pages
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
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!
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!
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.
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"
"The best place to find a helping hand is at the end of your own arm"
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
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"
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.
1. I create a script for the "Button_Click" in "planlist.aspx"
ASP.NET Syntax (Toggle Plain Text)
Sub Plan_Click(ByVal Sender As Object, ByVal e As EventArgs) Session("DataListCopy") = Datalist1.??? \\ Not sure what to use here to copy the whole datalist. 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.
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)
[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.
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)
ASP.NET Syntax (Toggle Plain Text)
Private Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load ' Add sample values. lstItems.Items.Add("Econo Sofa") lstItems.Items.Add("Supreme Leather Drapery") lstItems.Items.Add("Threadbare Carpet") lstItems.Items.Add("Antique Lamp") lstItems.Items.Add("Retro-Finish Jacuzzi") End Sub Private Sub cmdGo_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdGo.Click Dim Url As String = "QueryStringRecipient.aspx?" Url &= "Item=" & lstItems.SelectedItem.Text & "&" Url &= "Mode=" & chkDetails.Checked.ToString() Response.Redirect(Url) End If End Sub
[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.
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
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!
ASP.NET Syntax (Toggle Plain Text)
<%@ Page Language="VB" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="Server" type="text/VB"> Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs) Label1.Text = "This Works" End Sub </script> <script runat="server" type="text/VB"> Public Sub PlanClick(ByVal obj As Object, ByVal e As EventArgs) Response.Redirect("http://www.MyTargetPage.com") End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Floor Plan Lists</title> </head> <body> <form id="form1" method="post" runat="server" > <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" EnableTheming="False" OnClientClick="PlanClick" /> <asp:DataList ID="DataList1" runat="server" DataKeyField="ID1" DataSourceID="AccessDataSource1" RepeatColumns="2" RepeatDirection="Horizontal"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="Submit_Click" /><br /> ID1: <asp:Label ID="ID1Label" runat="server" Text='<%# Eval("ID1") %>'></asp:Label><br /> PlanNumber: <asp:Label ID="PlanNumberLabel" runat="server" Text='<%# Eval("PlanNumber") %>'></asp:Label><br /> </ItemTemplate> </asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Plans/floorplans.mdb" SelectCommand="SELECT * FROM [tblFPInfo]"></asp:AccessDataSource> </div> </form> </body> </html>
•
•
Join Date: Mar 2008
Posts: 68
Reputation:
Solved Threads: 11
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....
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....
ASP.NET Syntax (Toggle Plain Text)
<asp:DataList ID="DataList1" runat="server" OnItemCommand="DataList1_ItemCommand"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/progressAnimation.gif" CommandArgument ="uniquecolumn" CommandName ="navigate" /> </ItemTemplate> </asp:DataList> protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName = "navigate") { string uniquekey = e.CommandArgument.ToString(); //do something if u want Response.Redirect("~/somepage.aspx?uk=" + uniquekey); } }
Last edited by peter_budo; Jun 4th, 2008 at 4:43 am. Reason: Correcting code tags, the closing tag is [/code]
•
•
Join Date: May 2008
Posts: 6
Reputation:
Solved Threads: 0
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...
ASP.NET Syntax (Toggle Plain Text)
<%@ Page Language="VB" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="Server" type="text/VB"> Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs) Label1.Text = "This WOrks" End Sub </script> <script runat="Server" type="text/VB"> ' Script to redirect and post to querystring Sub DataList1_ItemCommand(ByVal source As Object, ByVal e As DataListCommandEventArgs) Handles DataList1.ItemCommand If (e.CommandName = "Navigate") Then Response.Redirect("plandetail.aspx") End If End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" method="post" runat="server" > <div> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> <asp:Button ID="Button1" runat="server" Text="Button" EnableTheming="False" OnClientClick="DataList1_ItemCommand" /> <asp:DataList ID="DataList1" runat="server" DataKeyField="ID1" DataSourceID="AccessDataSource1" RepeatColumns="2" RepeatDirection="Horizontal"> <ItemTemplate> <asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="DataList1_ItemCommand" CommandArgument="PlanNumber" CommandName="navigate" /><br /> ID1: <asp:Label ID="ID1Label" runat="server" Text='<%# Eval("ID1") %>'></asp:Label><br /> PlanNumber: <asp:Label ID="PlanNumberLabel" runat="server" Text='<%# Eval("PlanNumber") %>'></asp:Label><br /> </ItemTemplate> </asp:DataList><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/Plans/floorplans.mdb" SelectCommand="SELECT * FROM [tblFPInfo]"></asp:AccessDataSource> </div> </form> </body> </html>
•
•
Join Date: Mar 2008
Posts: 68
Reputation:
Solved Threads: 11
hi,
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.......
ASP.NET Syntax (Toggle Plain Text)
<asp:ImageButton ID="ImageButton1" runat="server" Height="135px" ImageUrl='<%# Eval("FrontElev_TN") %>' Width="180px" OnClientClick="DataList1_ItemCommand" CommandArgument="PlanNumber" CommandName="navigate" /><
hope u understood.......
got solution ?, please mark the thread as Solved. Thanks & Regards,srikanth kadem
srikanthkadem@rediffmail.com
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: detail view, different hyperlink based on data?
- Next Thread: Hi all
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol advice ajax alltypeofvideos anathor asp asp.net bc30451 bottomasp.net browser button c# c#gridviewcolumn checkbox child click commonfunctions compatible confirmationcodegeneration content contenttype courier css database datagridview datagridviewcheckbox datalist deadlock development dgv dropdown dropdownlist edit expose feedback flash flv form formatdecimal forms formview google grid gridview homeedition hosting iframe iis index javascript jquery list login menu microsoft migration mono mssql multistepregistration numerical object objects order panelmasterpagebuttoncontrols problem project ratings refer rotatepage save schoolproject search security serializesmo.table session silverlight smartcard sqlserver2005 suse textbox tracking typeof unauthorized update validation vb.net video view virtualdirectory vista visual-studio visualstudio web webarchitecture webdevelopemnt webservice xml youareanotmemberofthedebuggerusers





