473,320 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to show filed from previous page

how to show field from previous page?

please please please

I have two pages

1-main (first page)
2-mat (second page)

there is database filed in main (Major) i want to show it in label in the next page (mat)

code of main
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" EnableSessionState="True" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDb" %>
  4.  
  5.  
  6. <script language="VB" runat="server" id="LoginInfo2">
  7.  
  8.  
  9.  
  10.  
  11.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  12.  
  13.         L1.Text = Session("Login_Page")
  14.     End Sub
  15. </script>
  16.  
  17. <form id="form1" runat="server">
  18. <p>
  19.     Welcome To The User:
  20.     <asp:Label ID="L1" runat="server" Text="Label"></asp:Label>
  21. </p>
  22.  
  23. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
  24.     DataKeyNames="ID" DataSourceID="AccessDataSource1" 
  25.     EmptyDataText="There are no data records to display.">
  26.     <Columns>
  27.         <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
  28.             SortExpression="ID" InsertVisible="False" />
  29.         <asp:BoundField DataField="Std_Name" HeaderText="Std_Name" 
  30.             SortExpression="Std_Name" />
  31.         <asp:BoundField DataField="Std_Num" HeaderText="Std_Num" 
  32.             SortExpression="Std_Num" />
  33.         <asp:BoundField DataField="Major" HeaderText="Major" SortExpression="Major" />
  34.         <asp:BoundField DataField="Colg_Name" HeaderText="Colg_Name" 
  35.             SortExpression="Colg_Name" />
  36.         <asp:BoundField DataField="User_Name" HeaderText="User_Name" 
  37.             SortExpression="User_Name" />
  38.     </Columns>
  39. </asp:GridView>
  40. <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
  41.     DataFile="C:\Users\Sami\Documents\Visual Studio 2010\WebSites\WebSite12\db\MyDatabase.mdb" 
  42.     SelectCommand="SELECT * FROM [Student_Profile] WHERE ([User_Name] = ?)">
  43.     <SelectParameters>
  44.         <asp:SessionParameter Name="User_Name" SessionField="Login_Page" 
  45.             Type="String" />
  46.  
  47.  
  48.     </SelectParameters>
  49.  
  50.  
  51.  
  52. </asp:AccessDataSource>
  53. <p>
  54.     <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Matrlais.aspx">Display The Matrlais</asp:HyperLink>
  55. </p>
  56. </form>
  57.  
  58.  
  59.  
code of Matrlais

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" EnableSessionState="True" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.OleDb" %>
  4.  
  5.  
  6. <script language="VB" runat="server" id="LoginInfo2">
  7.  
  8.  
  9.  
  10.  
  11.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
  12.  
  13.         L1.Text = Session("Login_Page")
  14.     End Sub
  15. </script>
  16.  
  17. <form id="form1" runat="server">
  18. <p>
  19.     Welcome To The User:
  20.     <asp:Label ID="L1" runat="server" Text="Label"></asp:Label>
  21. </p>
  22.  
  23. <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
  24.     DataKeyNames="ID" DataSourceID="AccessDataSource1" 
  25.     EmptyDataText="There are no data records to display.">
  26.     <Columns>
  27.         <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" 
  28.             SortExpression="ID" InsertVisible="False" />
  29.         <asp:BoundField DataField="Std_Name" HeaderText="Std_Name" 
  30.             SortExpression="Std_Name" />
  31.         <asp:BoundField DataField="Std_Num" HeaderText="Std_Num" 
  32.             SortExpression="Std_Num" />
  33.         <asp:BoundField DataField="Major" HeaderText="Major" SortExpression="Major" />
  34.         <asp:BoundField DataField="Colg_Name" HeaderText="Colg_Name" 
  35.             SortExpression="Colg_Name" />
  36.         <asp:BoundField DataField="User_Name" HeaderText="User_Name" 
  37.             SortExpression="User_Name" />
  38.     </Columns>
  39. </asp:GridView>
  40. <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
  41.     DataFile="C:\Users\Sami\Documents\Visual Studio 2010\WebSites\WebSite12\db\MyDatabase.mdb" 
  42.     SelectCommand="SELECT * FROM [Student_Profile] WHERE ([User_Name] = ?)">
  43.     <SelectParameters>
  44.         <asp:SessionParameter Name="User_Name" SessionField="Login_Page" 
  45.             Type="String" />
  46.  
  47.  
  48.     </SelectParameters>
  49.  
  50.  
  51.  
  52. </asp:AccessDataSource>
  53. <p>
  54.     <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Matrlais.aspx">Display The Matrlais</asp:HyperLink>
  55. </p>
  56. </form>
  57.  
  58.  
  59.  
May 20 '11 #1
1 1548
Frinavale
9,735 Expert Mod 8TB
You could use a LinkButton instead of a HyperLink.
When the user clicks a LinkButton the page is submitted to the server. In the LinkButton's Click event, you can store the value in Session and use Response.Redirect to redirect the user to the next page.

Or you could continue to use the HyperLink and use JavaScript to insert the value into the QueryString so that you can retrieve the value on the next page.

-Frinny
May 31 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: middletree | last post by:
I need to capture the previous page's URL. I thought I could find a way to do it with client-side code, but I have been unable to find a way to do that, so perhaps there's an ASP solution. ...
1
by: Przemek P. | last post by:
I need a button, on click you can go previous page (like histry.go(-1)) and then the page is immediately refreshed. The first page is table from database. When you click to change item, another...
1
by: sri_san | last post by:
Hello, I am working on a website where I need to navigate to the previous page once the user clicks on "back" button. I store the previous page from the "HTTP_REFERER" Server variable and the...
5
by: David Lozzi | last post by:
Howdy, I have a cancel button, I would like to send them to the previous page they were on. For example, they are viewing a queue of tickets. They can click on a ticket and update it if they...
2
by: wiewiek | last post by:
Is there a way to go back to the previous page when a button (Cancel button) is hot? It's an ASP control. Thanks
2
by: ABC | last post by:
How to I know the previous page is clicked to forward the current page? As our web site have many methods to enter the web page, I need to know the users clicked which link or which part of...
2
by: theWizard1 | last post by:
Using Visual Studio.Net 2005, Asp.Net 2.0, and trying to use technique shown in the Programming Asp.Net 3rd Edition by O'Reily, page 257. On the first page, this would become the previous page, I...
5
by: Andy | last post by:
Hi, I want to prevent the user from viewing the previous page using the Back button after logout. I want to instead show that this page has expired. How do I do this? Here is my codebehind...
1
by: Jeff | last post by:
I need to place a "Previous Page" link on every page within my site and a simple javascript:history.back() will not work because I need it to capture the state of the page when I left it. For...
13
by: staeri | last post by:
I use javascript:history.go(-1) to return to the previous page. I've now found out that when returning to the previous page all selections that the user made in dropdownlists are lost. How can...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.