|
Avoid 'Repost' as well as 'Crosspost' from next time. It is considered rude.
Pick one forum based on the question and stick to it.
|
|
|
|
|
Hello Friends,
We have the following issue, please help us in getting rid of it.
Scenario:
We have an aspx page which contains two button controls. On click event of first button, generating excel sheet and prompting the user with the open/save dialog box.
Requirement:
Once the excel file generated and open/save dialog prompts to the user, the main window (which has two button controls) should be closed.
We are using the following code to return generated excel file:
Response.Clear();
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
string excelReportName = "MpmCostDataTemplate";
Response.AddHeader("Content-Disposition", "attachment; filename=" + excelReportName + ".xlsx");
..........................
and using the following statement to close the main aspx page window
Page.ClientScript.RegisterStartupScript(this.GetType(), "myCloseScript", "window.close();", true);
Issue is:
The above close statement is working fine if we remove the Response related code (that returns the excel file to the user). But its not working when we have Response related code in place.
Please let us know how can we get rid of this issue when we use Response kind of code.
Thank you,
Raheem MA
|
|
|
|
|
As you've found out you can't close the main window while the file is being streamed. You may be able to open a new window for the download then using window.opener close the main window.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thank you Mark for you response,
Is there any way to get the control back to the main window after the Excel file open/save pop up opens? Can't we access the controls after Response... related statements from code behind?
Please help us to get rid of this issue. And also it seems its an iteresting concept behind it. I want to know that clearly. It may help most of the developers. Please put the concept here to help most of our friends.
Thank you,
Raheem MA
|
|
|
|
|
It would be helpful if you read the response that was given, Window.Opener[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
try this:
Clicking on button will close window.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Button1.Attributes.Add("OnClick", "self.close()")
End Sub
OR
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write(" { self.close() }")
End Sub
|
|
|
|
|
Hello Tanweer,
Thank you for your response,
If we use this it works fine. But on button click event Excel file will be generated and pops up the open/save dialog. After the open/save dialog pops up, the main window should close. If we do not have this code, the attribute works fine without any issues.
The main issue is when we have Response... related code we could not close the main window.
Can you please give some idea to get rid of this?
Thank you in advance,
Raheem MA
|
|
|
|
|
Hi All ,
I want to add calender scheduler to integrate with my asp.net application is there any free scheduler available that i can integrate. i tried goggle it but with out any success.
thanks,
amit
|
|
|
|
|
|
|
Hi,
I want to display show times and the list of movies under it.
The display would be like this -
Show Time 6.30 PM
Movie 1
Movie 2
Movie 3
Show Time 9.30 PM
Movie 1
Movie 2
Movie 3
I want to display it in such a way that when I Click on "Show Time 6.30 PM" it would display the movies under that show and wont display anything under
"Show Time 9.30 PM". Now when I click on "Show Time 9.30 PM", all the contents inside "Show Time 6.30 PM" should shrink and the list of movies should be available
in "Show Time 9.30 PM".
I need some idea on how to do this, will it be achieved using a sliding panel, or is there any other control.
Note - For the show times and movie details I have a collection which I am binding it to a repaeter control.
Regards
Vinay
|
|
|
|
|
|
Hi,
I have tried using accordian but that`s not what i am trying to achieve here, please guide me If I am doing wrong.
If you look at the example given by me what I want is the Show Times 1 to shrink when Show Time 2 is clicked and display all the movies under show time 2.
I understand that under each Show Time there has to be panel, but my list is dynamic so I cannot manually set the number of panels. Can that be set from the code ?
What I am looking is for a SINGLE sliding panel which floats around every row in the table, So if Row 1 is clicked the panel displays the show times under it, when Row 2 is clicked, the data inside row 1 Is shrinked and the panel floats to down displaying the movies under Row 2.
Any Ideas?
Thanks
Vinay
|
|
|
|
|
How do I customise the behaviour of the asp:SiteMapPath to not show the root siteMapNode as a part of the breadcrumb.
<siteMapNode title="Root"…>
<siteMapNode title="Level_1_1"…>
</siteMapNode>
<siteMapNode title="Level_1_2"…>
<siteMapNode title="Level_2_1"…>
</siteMapNode>
</siteMapNode>
</siteMapNode>
Shold in the breadcrumb look like: Level_1_2 > Level_2_1
and not: Root > Level_1_2 > Level_2_1
_____________________________
...and justice for all
|
|
|
|
|
Place the following code in Global.asax:
void Application_Start(object sender, EventArgs e)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(HideRootNode);
}
static SiteMapNode HideRootNode(Object sender, SiteMapResolveEventArgs e)
{
SiteMapNode node = SiteMap.CurrentNode.Clone();
SiteMapNode current = node;
SiteMapNode root = SiteMap.RootNode;
if (current != root)
{
while (node.ParentNode != root)
{
node.ParentNode = node.ParentNode.Clone();
node = node.ParentNode;
}
node.ParentNode = null;
}
return current;
}
|
|
|
|
|
Thanks,
This little css-hack also made it for me:
.PageHeading > a:first-child + span + span<br />
{<br />
display: none;<br />
}
_____________________________
...and justice for all
|
|
|
|
|
Please suggest some IEEE projects in ASP.NET
|
|
|
|
|
|
First I must say, that I'm rather a beginner with ASP.NET, so my question might be stupid. If it is, please spend some time to explain me why it's like this
Let's say I have a DropDownList bound to a collection of items of some type. For example this type:
public class Country
{
public int Id
{
get;
set;
}
public string Code
{
get;
set;
}
public string Name
{
get;
set;
}
}
On the aspx page I place a DropDownList like this (button is only for triggering postbacks):
<asp:DropDownList runat="server" ID="test" DataTextField="Name" DataValueField="Code" /><br />
<asp:Button runat="server" ID="temp" Text="Postback" />
And in the code-behind for aspx I write:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (!IsPostBack)
{
test.DataSource = WebApplication2.Controls.CountriesDropDown.CountriesList();
DataBind();
}
}
(WebApplication2.Controls.CountriesDropDown.CountriesList() returns a Collection<country> instance)
And now, when I hit the postback button, on the server side I see the DataSource is null. However in the browser I can still see the countries displayed earlier.
Is there any way to have access to objects being bound, cause I don't want to generate the list again.
I didn't turn off ViewState (I found this suggestion when searching for solution)
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
lukasz_nowakowski wrote: if (!IsPostBack) { test.DataSource = WebApplication2.Controls.CountriesDropDown.CountriesList(); DataBind(); }
Change this to:
if (!IsPostBack)
{
test.DataSource = WebApplication2.Controls.CountriesDropDown.CountriesList();
test.DataBind();
}
|
|
|
|
|
Yeah... it is this way... I was writing this code from memory, not copied from Visual Studio. Sorry for mistake
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
I'm sending mail with excel attchment and it's working fine when I run it from my local
machine. but if I try to access it from another machine it's giving me this
Error:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
Error coming on first line of below code
Microsoft.Office.Interop.Excel.Workbook aBook;
Microsoft.Office.Interop.Excel.Application ExlApp = new Microsoft.Office.Interop.Excel.Application();
i have given all rights (http://blog.crowe.co.nz/archive/2006/03/02/589.aspx[^]) still error is coming
please help me out as soon as possible
|
|
|
|
|
|
Don't cross post here. If anybody answers your previous question then you will be notified in your registered email.
|
|
|
|
|
Hi,
We might want to use Entity Framework 4 for a project. Everything that we need is in the context. We have a couple of guys working on this project, how do we all work on the model if it creates just 1 file?
Is it possible to add additional properties to a class that was created?
Also, how would I use classes that I have created already in my project? Lets say I have a User class and a User class that the EF creates, what now?
Thanks
|
|
|
|