|
How can I initiate from AspPage2.aspx.cs the other project page AspPage1.aspx.cs to post-back(reload) itself?
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: How can I initiate from AspPage2.aspx.cs the other project page AspPage1.aspx.cs to post-back(reload) itself?
Can you explain me the scenario ? If you are in Page1 you can can reload the page2 by simple redirecting. I think your requirement is some think different. Can you please explain ?
Thanks !
|
|
|
|
|
|
Chesnokov Yuriy wrote: How can I initiate from AspPage2.aspx.cs
Means you want to postback from CodeBehind... This is weird.
Are you looking for Server.Execute ?? So that you could get the response of another page from code behind.??
|
|
|
|
|
I've got 2 pages that are opened. In the second page I do some modifications to Session object, then I need to reload first page so that changes would appear in it.
The 2 pages uses the Session object and simply the first one needs to be notified after the changes done from the second one.
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: I've got 2 pages that are opened. In the second page I do some modifications to Session object, then I need to reload first page so that changes would appear in it.
So, you are opening two different page in two different window/ Tab . And you want if you change the automatically on different page. I don't think so its possible unless you Refresh the page.
Because all the session operation performing on server side and the first page has already rendered on client side.
You can do one think, make the Page 1 as autorefresh for some interval. But that is not a good idea .
What is your business requirement ?
|
|
|
|
|
I've got main page, Page1.
The Page2 is opened with javascript window.open() attributed in some Page1 button control.
So I need to refresh Page1 from Page2
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: I've got main page, Page1.
The Page2 is opened with javascript window.open() attributed in some Page1 button control.
So I need to refresh Page1 from Page2
Ohhh... Man... Did you mention it earlier... that your Page 2 is popup
Or May be I missed it out.
use,
window.opener.RefereshPresentPage();
|
|
|
|
|
Yes, sorry, Page2 is a popup opened with window.open();
How should I call window.opener.RefreshPresentPage()?
There is a button click handler, where should I paste it?
Чесноков
|
|
|
|
|
|
- On Second page if changes done then set any flag in session.
- On First page poll the flag session periodically via javascript, if flag session set then submit the page throught javascript and perform operation accordingly.
|
|
|
|
|
but that will take some additional java script over head?
Чесноков
|
|
|
|
|
Yes you are right. I think it is a better.
|
|
|
|
|
Oh.. Is the second page is opening in a new window.
If so, just place a Javascript in the response.
this.ClientScript.RegisterStartupScript(typeof(Page), "myscript", "<script>window.opener.document.form[0].submit();</script>");
Or just
this.ClientScript.RegisterStartupScript(typeof(Page), "myscript", "<script>window.opener.location.href = "page.aspx";</script>");
Where page.aspx is the location of the other page.
Hope it works. I didnt tried it.
|
|
|
|
|
Yes, it is in the new window.
How can I attach that to some web control e.g. button?
I need to click a button in the Page2 and Page1 will refresh.
Чесноков
|
|
|
|
|
Simple..
write the RegisterScript code inside the Button_click event, if you need it from the server.
Or just write window.opener.location.href = 'yourpage.aspx'; return false;
in onClientClick event.
return false will eliminate postback if you want.
|
|
|
|
|
How can I put it into the button click code?
buttonClick()
{
} ;
Чесноков
|
|
|
|
|
Try this :
btn.Attributes.Add("onclick", "javascript:window.opener.location.href='page1.aspx'; return false;");
write this in page_load of Page2.aspx .
So that when btn is clicked it will refresh the page1.aspx
Hope it works now.
|
|
|
|
|
hi all,
I want to download the file from db which has been save in my application.I downloaded the file . but i want to open it as a pdf file.How to do that..
Here is the code i used to download.
if (e.CommandName == "ResumeDownload")
{
Cache["filename"] = e.CommandArgument.ToString();
String strRequest = Cache["filename"].ToString();
if (strRequest != "")
{
String path = Server.MapPath("Attachments\\" + strRequest);
FileInfo file = new FileInfo(path);
if (file.Exists)
{
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + file.Name.ToString()+ "\"");
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
else
ClientScript.RegisterStartupScript(typeof(Page), "alert", "<script>alert('File Not Found')</script>");
}
else
Response.Write("Please provide a file to download.");
}
|
|
|
|
|
Try changing the ContentType to application/pdf. I haven't tried this so there is every chance it won't work but you never know.
|
|
|
|
|
|
DoctorMick wrote: application/pdf
this wont work.. This will open a pdf but without any content.....
|
|
|
|
|
Hi everyone, I am trying to write a web method in my web service which will accept information in a hashtable and process it and again will return hashtable. I am trying to do this in C#. But it is throwing an exception that hashtable can't be serialized b'coz it implements IDictionary. Is there any solution.....
|
|
|
|
|
Yes it's write, Only serializable object can return the web method. So Implement this information in dataset and the finally return Dataset.
OR look into this Article
Hashtable becomes serialized[^]
|
|
|
|
|
Hello every one,
I want to create a stored procedure,which takes different parameters and insert the value in same table.
What should i do,how can i write this.
|
|
|
|