 |
| ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 9th, 2010, 11:31 AM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
content page within a master page
Hi,
I have an issue.
I have a content page within a master page.
When I display the content page by Response.Redirect("content1.aspx");
The values in the text boxes of the master page disappeared.
What should I do ?
Thanks,
Ran
|
|

April 9th, 2010, 12:27 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Ran,
This is by design. Response.Redirect instructs the browser to fetch a new page. This means that all state from the current page is lost.
If you explain your scenario in a bit more detail, I may be able to suggest you some solutions.
Cheers,
Imar
|
|

April 9th, 2010, 12:38 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks,
I'll explain,
I have a master page contains some information reside on some text boxes.
I have also a button on the master page that when I click on it, it redirect the content page to be displayed in the content area of the master page.
The problem is that when I click on the button the content is displayed but the values of the text boxes of the master page are disappeared.
Your advise will be appriciated.
Thanks,
Ran
|
|

April 9th, 2010, 12:55 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, I understood that from your initial problem description.
However, it would be useful to know why you want to maintain that text there. E.g. what's it used for, why do you need it, where does it come from and so on.
There are many ways to maintain this data, but the best solution depends on your requirements...
Imar
|
|

April 9th, 2010, 01:09 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'll explain,
In the master page I have some info about a person like name, address and so on.
In the content pages I have some additional information about that person, like his driving license details and in the other content pages I have more info like his driving penalties details and so on.
I want to navigate between the content pages without losing the info on the master page.
And one more thing, how can I forward parameters to the content page from the master page, since I have to query some info in the content page from the data base, I have to have the ID of the person for the query, this ID is in the master page and I should use it in the content page.
Thanks,
Ran
|
|

April 9th, 2010, 01:24 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You're still not very clear about this.
Where does this data come from? From a database? Did the user just enter it and are you creating a wizard like interface? Do you need to store this only for one or two consecutive pages or must this data be available as long as the user is on the site? Does the data come from the user's profile? Does it need to be persisted between two browser sessions and so on?
You can forward data from one page to another using many different mechanisms, including session state, form state, cookies, query string variables, databases and more. Again, the one you need in this case depends on your scenario. Maybe you need session state, maybe you need to reacrhitecture your pages and use a single page model with, say, a Wizard control. Maybe you need to store the data in the database and rerequest it on each page request. It all depends.
So, be specific, and I can give you a useful answer. Otherwise, we're just going round in circles....
Cheers,
Imar
|
|

April 9th, 2010, 01:39 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The data in the master page is entered on-line by the user.
I do not create any wizard.
Yes the info have to be available as long as the user is on the site.
I'm using only one browser not two.
The data doesn't come from the user profile, the user enters it on-line.
I just want to navigate between the content pages that reside within the master page without losing the master page information.
Thanks,
Ran
|
|

April 9th, 2010, 01:53 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
In that case, store data in Session state when it gets submitted, and try setting it again in Page_Load (when Page.PostBack is not true) in the Master Page. For more details:
http://msdn.microsoft.com/en-us/library/ms178581.aspx
Out of curiosity, why would you want to store data in the page only during the user's session?
Imar
|
|

April 10th, 2010, 02:23 PM
|
|
Registered User
|
|
Join Date: Apr 2010
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thanks for your help, one more small issue,
I'd like to set a query to a GridView control in order this GridView display the query result.
I do the following but I can not see the gridview,
What should I do, please advise.
Thanks,
protected void Page_Load(object sender, EventArgs e)
{
string oradb = "Data Source=LOCAL_XE;User Id=tzdl_user;Password=rans;";
OracleConnection conn = new OracleConnection(oradb); // C#
conn.Open();
OracleParameter parm = new OracleParameter();
parm.OracleDbType = OracleDbType.Decimal;
parm.Value = 777;
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.Parameters.Add(parm);
cmd.CommandText = "select * from competence_test where id_num = :1";
cmd.CommandType = CommandType.Text;
OracleDataReader OraRecReader = cmd.ExecuteReader();
CompetenceTestGridView1.DataSource = OraRecReader;
conn.Dispose();
}
|
|

April 10th, 2010, 05:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
You need to call DataBind on the CompetenceTestGridView1 control afrer you've set the DataSource property.
Did you resolve the issue with the form controls and state? If so, would you mind sharing how you solved it?
Imar
|
|
 |