|
ya its fine..and some one douats
i display first 3 charter and assign in other textbox..Sir/Mam,
I'm Kannan.I Like very much for the coding for the project
THANKNG YOU
KANNAN
|
|
|
|
|
Hi, this will be a bit tricky to explain but I'll try my best.
Original page:
I have a page with a button, which when clicked will generate a spreadsheet and prompt the user to download this spreadsheet.
Changes:
Now since we didn't want to the page to refresh,
and at the same time we didn't want to implement an UpdatePanel to this page,
we changed this button to a link which pops-up a new page.
New page:
The new page simply contains this button and a javascript link to close the window.
I did not change the source code of the generate-spreadsheet method.
Generate spreadsheet method:
public static void Export(Page webPage)
{
webPage.Response.Clear();
webPage.Response.Buffer = true;
webPage.Response.Charset = "";
webPage.EnableViewState = false;
string filename = "spreadsheet.xls";
webPage.Response.ContentType = "application/vnd.ms-excel";
webPage.Response.ContentEncoding = Encoding.Default;
webPage.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ";");
string filePath = string.Format("{0}temp\\{1}", webPage.Request.PhysicalApplicationPath, fileName);
populate(filePath);
webPage.Response.TransmitFile(filePath);
webPage.Response.Flush();
File.Delete(filePath);
webPage.Response.End();
}
Problem:
Now here's my problem, the code works perfectly on my local machine, but does not work when I deployed on the server.
On my local, it correctly gives me a download dialog with "spreadsheet.xls" displayed.
On the server, it gives me a download dialog, but the URL (http://www.oursite.com/WebForms/WFrmExport.aspx) of the pop-up page is displayed instead. So when I click "Save", it will just give me an error.
Additional notes:
1. The same export method is used in the original page and the new pop-up page
2. Both original pages and pop-up pages are webforms (*.aspx)
3. The original page works on the server... meaning it correctly prompts me to download "spreadsheet.xls". The problem only occurs on the pop-up page and only on the server.
4. If I remove the File.Delete(filePath); statement, I will see the generated spreadsheet.xls in the correct filepath server directory, which is the same directory used by the original page.
What could be the problem?Rafferty
modified on Friday, February 26, 2010 12:40 AM
|
|
|
|
|
I this it may be the issue of reading file form the server machine so you have to set account of the person who can access the local file system form server to do this :
go to IIS Manager > right click on DefaultAppPool
>> Go to poperties >> Go to Identity Tab >> set security account to local system
|
|
|
|
|
Hi, thanks for your reply. I don't think this is the problem because it can properly download the file if I revert back my changes in the server. The old code and the new changes both access from the same file location.
this is a big headacheRafferty
|
|
|
|
|
I finally found the solution!
I also had to clear the headers of the response, apparently, Response.Clear() only clears the content.
Maybe the header was somehow populated incorrectly by the new pop-up page.
So the fixed method is:
public static void Export(Page webPage)
{
webPage.Response.ClearHeaders();
webPage.Response.Clear();
webPage.Response.Buffer = true;
webPage.Response.Charset = "";
webPage.EnableViewState = false;
string filename = "spreadsheet.xls";
webPage.Response.ContentType = "application/vnd.ms-excel";
webPage.Response.ContentEncoding = Encoding.Default;
webPage.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName + ";");
string filePath = string.Format("{0}temp\\{1}", webPage.Request.PhysicalApplicationPath, fileName);
populate(filePath);
webPage.Response.TransmitFile(filePath);
webPage.Response.Flush();
File.Delete(filePath);
webPage.Response.End();
}
Thanks to all who wanted to help! Rafferty
|
|
|
|
|
I am trying to get jquery datepicker to work on a textbox I have on an asp usercontrol.
This is what I have been trying to achieve:
when a menuclick event is fired from a menu control on the parent page,
The usercontrol is loaded into the placeholder (which is itself placed in an ajax update panel on the parent page)on the parent page . Please how do I register the jquery datepicker on the usercontrol. I need detailed explanation cuz am kinda new to asp, with little experince with client scripts. I am working with c#, thanks.
|
|
|
|
|
Have you read the JQuery documentation[^]?
$("id of textbox").datepicker();
That's it. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hello,
I have defined an entity data model in my ASP.NET VB project that contains a PartList entity. I have created an entitydatasource that returns the Part Name, NSN and RecID (primary key). I have also created a dropdown list that contains values PartName and NSN and a textbox that will contain the search criteria.
How would I define my entitydatasource parameters to query it.[NSN] if dropdownlist.selectedvalue = NSN and query it.[PartName] if dropdownlist.selectedvalue=PartName and submit the textbox.text as the search string? Is gridview a good candidate to display the results? Should the search controls and gridview be placed on the same page or separate pages? Finally, the ultimate goal is for the user to click the checkbox next to the parts they want and those selected parts are passed on to a wizard control. Do I use stringbuilder to get the selected parts and send them to the wizard control?
Thanks,
Sid
|
|
|
|
|
Hi
I am building a library of asp.net user controls which I am deriving from a custom UserControlBase class which further derives from actual UserControl class. Hierarchy looks like this :
ASCX -> UserControlBase : UserControl
I have this requirement to put a border around all the ASCX's. So, I thought if I can modify UserControlBase it will apply to all ASCXs. I tried following code in Page_Load of UserCOntrolBase but its not working
this.Attributes.Add("style", "border-color:#FFFF66;border-width:4px;border-style:Dashed;");
What should I do to make it work? Please advise.
Thanks
AJFollow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
You should use CSS classes rather than hard code these values. When users ask to change it, and they will, it will be much easier.
Create a div in the control to act as the border and set its properties not the control itself. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Agree with Mark Nischalke, Css more easier
|
|
|
|
|
Hi,you can try like this: XXX.Style["border-color"] = "#FFFF66;border-width:4px;border-style:Dashed";
modified 27-May-14 4:53am.
|
|
|
|
|
Hello,
I am having trouble getting an RSS feed to work on a college project, I am using code based on a tutorial I got from here http://blogs.msdn.com/coding4fun/archive/2006/10/31/912335.aspx
When i try to run I am getting an error that looks a bit like this
Server Error in '/' Application.
--------------------------------------------------------------------------------
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The base class includes the field 'rssFeed', but its type (RssList) is not compatible with the type of control (ASP.rsslist_ascx).
Source Error:
Line 7:
Line 8:
Line 9: <rss:feedControl ID="rssFeed" runat="server" />
Line 10:
Line 11:
Source File: /News.aspx Line: 9
Any help with this problem would be fantastic.
Cheers,
D
|
|
|
|
|
they have used UserControl. u just try without UserControl, the method is very simple. just have a look
1. call the RSS content with its URL. It will return XML
2. Convert XML to dataset
3. Since u got the dataset you know what to do
4. Show That in u r page/ if u want u can store that also for future.
5. If u want to format the resultant XML use XSLTmodified on Friday, February 26, 2010 1:42 AM
|
|
|
|
|
how do u edit the labels in a listview dynamically for the header template in vb.net
we have labels for header template and depending upon the value of one of the columns in the datasource the header label needs to change.
|
|
|
|
|
hi,
how to publish website throught IIS
|
|
|
|
|
Have you at least tried to read the documentation or have go? What problems did you encounter? What did you do to try to resolve them before posting here?Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
|
|
thanks a lot its helpful to me thanks
|
|
|
|
|
Hi there..
im workin on a website at the moment in asp.net, using vb.net, in the visual studios 2008 IDE! i just wish to add an extra feature and hopefully someone out there might be able to help.
I have a button that reads the values of 5 radio buttons in a radiobutton list, then queries the database, returning results based on the values selected. If no value is returned i wish to display a message saying "No Results this time, please search again" or something to that effect. Im not sure how to do this. here is the code i have behind the button.. Please advise.
Protected Sub btnSuggest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSuggest.Click
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dr As SqlDataReader
Dim varBatteryLifeQ As String = ""
Dim varMemoryQ As String = ""
Dim varRam As String = ""
Dim varScreenSize As String = ""
Dim varWebcam As String = ""
myConnection = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True")
myConnection.Open()
varBatteryLifeQ = RadioButtonList1.SelectedValue.ToString
varMemoryQ = RadioButtonList2.SelectedValue.ToString
varRam = RadioButtonList3.SelectedValue.ToString
varScreenSize = RadioButtonList4.SelectedValue.ToString
varWebcam = RadioButtonList5.SelectedValue.ToString
myCommand = New SqlCommand("Select * From LPU400 Where BatteryLife = '" + varBatteryLifeQ + "' AND Memory = '" + varMemoryQ + "' AND RAM ='" + varRam + "' AND ScreenSize ='" + varScreenSize + "' AND Webcam ='" + varWebcam + "'", myConnection)
SqlDataSource2.SelectCommand = "Select * From LPU400 Where BatteryLife = '" + varBatteryLifeQ + "' AND Memory = '" + varMemoryQ + "' AND RAMQ ='" + varRam + "' AND ScreenSize ='" + varScreenSize + "' AND Webcam ='" + varWebcam + "'"
SqlDataSource2.DataBind()
dr = myCommand.ExecuteReader()
While dr.Read()
End While
dr.Close()
myConnection.Close()
End Sub
Thanks in advance,
Daithi
|
|
|
|
|
Before you proceed with dr.Read() check if dr.HasRows . If yes proceed to read, else put "No Results this time, please search again" in a label or some other place holder.
HTH!
|
|
|
|
|
ya that did it! thanks a million for your help! very much appreciated!
|
|
|
|
|
Hi,
I want to develop an application using asp.net in which user can create reports by dropping labels and database fields and move and place them any where they like in other words design report as per there requirement (during runtime) and then save that format and call that report. Is there any possiblity to make such application.
waiting for your response.
|
|
|
|
|
Yes its possible, but u need to predefine the Report format(if u want different types of format) or else fix the format(controls that are dropped/Selected by user will be placed in left to right format only) and u can achieve the user generated report.
i have done this in one of projects
|
|
|
|