|
Using Server.Transfer you can not redirect to a different from the server itself.
Example if your server is www.yahoo.com you can use server.transfer to move
to www.microsoft.com but yes you can move to www.yahoo.com/travels, i.e.
within websites. This cross server redirect is possible only using
Response.redirect.
|
|
|
|
|
Have you checked this article[^]?
Let me know if this helps you or not.
|
|
|
|
|
i have checked but i cant understand that article....
i m so confused....my que is can we transfer the data from one page to another using view state...
that que asked in my interview but i not getting satisfaction yet bcoz some people saying that it can be possible....
|
|
|
|
|
|
What the State Management Types?
Client-side state management stores information on the client’s computer by embedding the information into a web page (Hiddenfields), URL (Query strings) or a cookie.
1. View state.
2. Control state: If you create a custom control that requires view state to work, you should use control state to ensure (يضمن) other developers don’t break your control by disabling view state.
3. Hiddenfields: hidden fields store in HTML form without displaying it in the user’s browser.
4. Cookies: cookies store a value in the user’s browser.
5. Query strings: query string stores values in URL.
Server-side state management stores information on server’s memory.
1. Application state.
2. Session state.
3. Profile Properties.
4. Cache state.
What the disadvantages are of ViewState?
- Disadvantages of ViewState:
1. The more controls you have on the form the larger the size of ViewState and the larger the size of the HTML you send back and forth to the server.
2. Only works when pages postback to themselves.
3. You can't persist (تحفظ) data to other pages.
|
|
|
|
|
thanx.........have u seen that link of asp.net forums which i have posted here,in that with examples they have explaine it can be possible so confused n asking.......
whats your opinion on that discussion........all that ans were wrong on that?
|
|
|
|
|
actually i am too preparing for interview... in my preparing and experience i have never heard that the viewstate can be transfered from one page to another......
|
|
|
|
|
vid nandha wrote: whats your opinion on that discussion
The opinion is very simple - viewstate is page specific. This should be enough to remove your confusion.
Now you mentioned that Server.Transfer with respect to this topic.
1. Server.Trasfer allows you access the instance of the source page. Using that you can access any property defined in that. It's not about accessing the ViewState, it's about accessing the reference of the source page.
2. In practice, a class hides the members which other class can not access. There should be some interfaces (methods) which would allow other classes to interact with the members. Now suppose you have all public properties then what's use of wrapping them. The same thing is applicable here.If you can access the source page's instance in the target page (while Server.Transfer),you can access everything of that page (if you wish) not only the ViewState.
As a practice, you can not access ViewState of any page from other page.
|
|
|
|
|
no. thats specific answer. as per your question specification, answer is no.
u can not use viewstate data in other page. so don't go for any forum or other.
hope thats fine.
Regards
Keyur Satyadev
|
|
|
|
|
Hi There I have menu tree.I had given path of my web forms in menu tree using naviage url propery.My web forms are present in admin folder. My problem is that when I run the project using following code then my page doesn't get open.
Menu Tree Code
<asp:menu id="Menu1" runat="server" skinid="Menu">
<items>
<asp:menuitem text="Admin" value="Admin">
<asp:menuitem navigateurl="~/Admin/Company.aspx" text="Company Master"
="" value="Company Master">
<asp:menuitem navigateurl="~/Admin/BranchMaster.aspx" text="Branch Master"
="" value="Branch Master">
<asp:menuitem navigateurl="~/Admin/CreateUser.aspx" text="Create User"
="" value="Create User">
<asp:menuitem navigateurl="~/Admin/RoleMaster.aspx" text="Role Master"
="" value="Role Master">
But when I keep my web forms in root directory and Change the path to
NavigateUrl="~//Company.aspx" then it works.Why this is happening
Even I tried ~//Admin/CreateUser.aspx but it is also not working.
Can anybody tell me what is the reason.
(I am running my project web server on net)
Life Is Beautiful
modified on Tuesday, August 11, 2009 2:51 AM
|
|
|
|
|
try navigateurl like this
Replace (~) with (..)
asp:Menu id="Menu1" runat="server" SkinID="Menu">
<asp:MenuItem Text="Admin" Value="Admin">
<asp:MenuItem NavigateUrl="../Admin/Company.aspx" Text="Company Master"
Value="Company Master">
<asp:MenuItem NavigateUrl="../Admin/BranchMaster.aspx" Text="Branch Master"
Value="Branch Master">
<asp:MenuItem NavigateUrl="../Admin/CreateUser.aspx" Text="Create User"
Value="Create User">
<asp:MenuItem NavigateUrl="../Admin/RoleMaster.aspx" Text="Role Master"
Value="Role Master">
|
|
|
|
|
Thanks for reply Zafar,
I will try your code. But when googled on this problem every body suggested not use ../ Instead of they suggested to use ~/
Life Is Beautiful
|
|
|
|
|
I tried that code but it is not working.
Life Is Beautiful
|
|
|
|
|
~//Admin/CreateUser.aspx
"/" is considered as a escape sequence...
so use ~//Admin//CreateUser.aspx ... hope this will work
|
|
|
|
|
Of course it won't. Since when is "/" the escape sequence of anything?
In C# the escape sequence is "\".
The problem lies with the layout though. You have to embed menuitems in an Items tag, like this:
<asp:Menu runat="server">
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" Text="New Item" Value="New Item">
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Default2.aspx" Text="New Item"
Value="New Item"></asp:MenuItem>
</Items>
</asp:Menu>
Also, would really be advisable if you actually CLOSED your menuitem tags. The path is correct as it is.
var question = (_2b || !(_2b));
|
|
|
|
|
ais07 says:
But when I keep my web forms in root directory and Change the path to
NavigateUrl="~//Company.aspx" then it works.Why this is happening
Even I tried ~//Admin/CreateUser.aspx but it is also not working.
there is no error message metioned....
|
|
|
|
|
i have three textboxs,that contains
1) number of female students (txtfemale)
2) number of male students (txtmale)
3) total number of students (txttotal)
now i want that when i enter records in the first two textboxs it show total number of students in txttotal automatically.
what should be my code??
|
|
|
|
|
please read basic book of programing. how to add two numbers
|
|
|
|
|
haleemasher wrote: now i want that when i enter records in the first two textboxs it show total number of students in txttotal automatically.
what should be my code??
You can easily do it using javaScript. Use onblur event of txtmale textbox, call a javascript function, where get the value of txtfemale and txtmale and calculate the sum and put it on txttotal using javasctipt itself.
Hope, It will help you
|
|
|
|
|
|
i want to display a menu on user home page. The menu items will be added / updated by admin(client) in admin section after I deploy the project to him. He would be shown a page on which he would add the various menu items. These would be stored into databse and then displayed on menu at home page. Can someone help me with the code for implementing this?
|
|
|
|
|
|
Create a table with fields
MenuCaption,NavigateUrl etc
the fields without navigateurl should be update able.
then on home page retrieve all the fields and add it to menu as menuitem.
Like this
SqlConnection con=new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString);
SqlDataAdapter da = new SqlDataAdapter("select * from mainMenu", con);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
foreach (DataRow row in dt.Rows)
{
MenuItem itm = new MenuItem(row["MenuCaption"].ToString(), "value", "", row["NavigateUrl"].ToString());
Menu1.Items.Add(itm);
}
}
|
|
|
|
|
Hi,
I want to implement export to excel functionality by clicking a button, using asp.net mvc and ajax.
for this if i am using html.beginform posting back is happend,but I dont want postback.
Can anybody guide me without posting back how to implement this function using ajax.beginform.
Thanks in Advance.
|
|
|
|
|