Hi all,
I am a newbie to asp.net web applications.
My web application consists of various aspx pages. The Default.aspx page is made up offrames, where each of the frames's source is an aspx page. It consists of 3 frames. The first frame's source page is First.aspx. The second frame's source page is Second.aspx. The third's is Third.aspx.
Is itcorrect to have like this. I have made the source of each frame as anaspx page because I want to display the items in each frame usingRepeater control.
The application's start page(which is StartPage.aspx) takes the query string, calculates theresult and sets the value to a variable named Result.
Now I want to use this Result object in the source aspx pages of eachframe. I want to load each of the frames with some values, depending onthe Result value. So, how do I share this variable Result?
Any help will be appreciated
Please help me!!!!!!!!!!!
sairaj:
Hi all, I am a newbie to asp.net web applications.
My web application consists of various aspx pages. The Default.aspx page is made up of frames, where each of the frames's source is an aspx page. It consists of 3 frames. The first frame's source page is First.aspx. The second frame's source page is Second.aspx. The third's is Third.aspx.Is it correct to have like this. I have made the source of each frame as an aspx page because I want to display the items in each frame using Repeater control.
The application's start page(which is StartPage.aspx) takes the query string, calculates the result and sets the value to a variable named Result.
Now I want to use this Result object in the source aspx pages of each frame. I want to load each of the frames with some values, depending on the Result value. So, how do I share this variable Result?
Any help will be appreciated Please help me!!!!!!!!!!!
Regarding the frames, you can use them if you want. However, many developers avoid them because they can be difficult to manage, they are not easily indexed by search engines, they are not supported in some browsers, and so on. Using User Controls and/or Master Pages can almost always replace the use of frames.
Regarding the values, you can read/write data to an object called "Session", which is available on every page, like this...
private void TestWriteToSession()
{
this.Session["MyKey1"] = "some string value";
this.Session["MyKey2"] = 1;
}private void TestReadFromSession()
{
string myValue1 = Convert.ToString(this.Session["MyKey1"]);
int myValue2 = Convert.ToInt32(this.Session["MyKey2"]);
}
There are many ways to share data. Using Session is just one.
Note that Session is a decent choice under certain conditions, such as -- when it is used to store built-in data types (string, int, double, etc) AND when the data is not too large in terms of storage size-- that is, it is not a good idea to store a string that has 1-million characters in it into Session.
HTH.
Thank you.
-- Mark Kamoski
Hi Mark,
I think I will be more specific to what my application should support. I am trying to write a clustering search web application. So the start page consists of a TextBox and a search button. After the user enters the query into the TextBox, I extract the query, get the results and cluster them into various groups. Now, I want to display the cluster labels on the left side of the page, and the right side should contain all the results. Also, when the user clicks on any cluster label on the left side, the right side should be loaded with the snippets belonging to that particular cluster. Also, the TextBox and the Search button should be there on top of the page, so that users can enter the next query string. Can you give me a suggestion for the approach that I should take.
Thank you
I agree with Mark that you want to avoid frames if possible. for the application that you are talking about I think having a page that consists of several user controls will work very well. One user control would contain the search input, button and search logic. A second user control would contain the consolidated search results The third would display the result details. This could all be perform without the use of controls, but by spliting it into user controls it offers flexibility moving forward.
Here are couple links that you might find useful
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/masterpages/default.aspx
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/userctrl/default.aspx
Here are some links that may help:
How to: Pass Values Between ASP.NET Web Pages
ASP.NET State Management Recommendations
sairaj:
Hi Mark,
I think I will be more specific to what my application should support. I am trying to write a clustering search web application. So the start page consists of a TextBox and a search button. After the user enters the query into the TextBox, I extract the query, get the results and cluster them into various groups. Now, I want to display the cluster labels on the left side of the page, and the right side should contain all the results. Also, when the user clicks on any cluster label on the left side, the right side should be loaded with the snippets belonging to that particular cluster. Also, the TextBox and the Search button should be there on top of the page, so that users can enter the next query string. Can you give me a suggestion for the approach that I should take.
Thank you
I would suggest doing it just as sairaj mentions above-- by using User Controls.
There are other ways too; but, User Controls are pretty easy, very flexible, and will suit the requirements that you have outlined.
HTH.
Thank you.
-- Mark Kamoski
0 comments:
Post a Comment