|
|
the below is my javascript.
function getCheckedRadio()
{
if(document.getElementById("SOISummitRegistrationCntrl1_RdbtnRegAdvPck").checked==true)
{
return true;
}
else if(document.getElementById("SOISummitRegistrationCntrl1_RdbtnRegOnly").checked==true)
{
return true;
}
else
{
alert("Please check the option");
return false;
}
}
Bharath.S Ron
|
|
|
|
|
remove alert then try
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hey Sathish you changed your login name Why ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Sandeep Akhare wrote: Hey Sathish you changed your login name Why ?
He was trying to hide on another name, Because his first name made lot of issues. But all CP members can identify him seeing his style of writing. That he can't change.
|
|
|
|
|
|
Hi !
Here is what I would like to do.. User clicks on a button.
I want to create a report in text mode (generated by my ASP .NET application - C#) and then show a download box on the browser of the user to allow him to download this report. The filename of the report will be defined previously.
I have delete all header from my aspx page to just leave this
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PageName.aspx.cs" Inherits="PageName" %>
and in my code behind i do:
Response.Write ("xxx");
How to show the download box on the screen ?
Thanks !
-- modified at 3:09 Friday 21st September, 2007
-- modified at 4:15 Friday 21st September, 2007
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
cREATE .TXT FILE DYNAMICALLY, WRITE CONTENT AND SAVE IT IN THE SERVER.
YOU CAN EASILY DOWNLOAD FROM THERE
bEST rEGARD
pATHAN
---------------------------------------------------
|
|
|
|
|
As Pathan said create a file at the server and store that file in one of the folders of your application and then download it bu using this code
<br />
string filename = "YourFileName.txt";<br />
<br />
if (filename != "")<br />
{<br />
<br />
string path = Server.MapPath(filename);<br />
<br />
System.IO.FileInfo file = new System.IO.FileInfo(path);<br />
<br />
if (file.Exists)<br />
{<br />
<br />
Response.Clear();<br />
<br />
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);<br />
<br />
Response.AddHeader("Content-Length", file.Length.ToString());<br />
<br />
Response.ContentType = "application/octet-stream";<br />
<br />
Response.WriteFile(file.FullName);<br />
<br />
Response.End();<br />
<br />
}<br />
<br />
else<br />
{<br />
<br />
Response.Write("This file does not exist.");<br />
<br />
}<br />
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Thank you Sandeep for your answer.
1. unfotunately your code does not work... this condition is never true:
if (file.Exists)
=> i modify your code and it's working...
if (filename != "")
{
string path = Server.MapPath ( filename );
System.IO.FileInfo file = new System.IO.FileInfo ( path );
StreamWriter fp = File.CreateText ( path );
fp.WriteLine(text);
fp.Close ();
if ( file.Exists )
{
Response.Clear ();
Response.AddHeader ( "Content-Disposition", "attachment; filename=" + file.Name );
Response.AddHeader ( "Content-Length", file.Length.ToString () );
Response.ContentType = "application/octet-stream";
Response.WriteFile ( file.FullName );
Response.End ();
}
else
{
Response.Write("This file does not exist.");
}
}
2. I'm certain there is a way to show the download box without writing the file on the server.
Thanks !
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
Do one thing then get all content of your file in stream and pass that stream in this method hope that will help
By the way whats the problem in creating a file ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
There are already articles[^]on CodeProject that tell you how to do this.
Did you check before you posted?
Paul
|
|
|
|
|
No i didn't found it !
Thanks a lot !!!
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
hi,
what is the difference between writing a code within #region and endregion and wrtiing it normally. why in some programs they write code in between #region and Endregion.
Regards
Vijay.
|
|
|
|
|
Region do not influence the code or execution of the program. It is just a facility to give the code more readable. It is just more easy to read if you have a class with 2000 lines.
La Richesse & la Gloire ne griseront jamais que les temples
|
|
|
|
|
vijay_83 wrote: what is the difference between writing a code within #region and endregion and wrtiing it normally.
No difference at all
vijay_83 wrote: why in some programs they write code in between #region and Endregion.
Organizing methods in regions is always a best practice. Your class will be easy to maintain. And if your class is very big, you will see big scrollbar. This will be tough to the desired function. If your methods are organized in regions, it can be collapsed when it is not in use. This helps to find the desired methods easily.
|
|
|
|
|
Vri SSK wrote: When pasting as a region, the clipboard text will simply appear between #region and #endregion tags with a region name of your choice. This feature is often helpful when organizing code within your application or pasting regions of code developed by someone else.
First, copy a piece of code like this one to your clipboard:
private void DoSomething( )
{
//Write Code Here
}
Then select Paste As -> Region, and you will see the dialog shown in Figure 2-5.
From this dialog, you specify the name of the region that you want to use; after you click OK, this code will be pasted into your document:
#region DoSomething Method
private void DoSomething( )
{
//Write Code Here
}
#endregion
Do you mind stopping copying code from other website and paste it over here ? You are doing copyright violations. Your post is exactly copied from here[^].
|
|
|
|
|
|
Sandeep Akhare wrote: Every one does not make research just they read it from anyother website/books and share it .
May be.
But at least he can post the link instead of copying it here. I feel this is not sharing, simply learning how to copy content. You can see in his post one figure name has referred. If CP allows image uploading, he would have copied that too. So it is copied without reading fully.
[edit]
Original post has been deleted by him
[/edit]
|
|
|
|
|
Thats true
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Hello,
first note that this code concerns .net framework 1.1.
I'm having trouble with the following: I have a class derived from Page. In
the Page_Load of this class I'd like to do the following:
HtmlForm form = new HtmlForm();
form.Name = "test";
form.ID = form.Name;
form.Controls.Add(_header);
using LoadControl(...)
form.Controls.Add(_menu);
...
for(int i = 0; i < Page.Controls.Count; i++)
{
form.Controls.Add(Page.Controls[i]);
}
form.Controls.Add(_footer);
Page.Controls.Clear();
Page.Controls.Add(form);
What I'd like to achive is to have a base page with a couple of controls on,
from which i can derive further.
The problem I'm having is, that on each round in the for loop, when I "read"
the Page.Control at the given index, the Page.Controls.Count decreases by
one.
Could somebody please shed some light. Thanks in advance!
Greetings from Berlin,
Matthias
/matthias
I love deadlines. I like the whooshing sound they make as they fly by. [Douglas Adams]
|
|
|
|
|
matthias s. wrote: The problem I'm having is, that on each round in the for loop, when I "read"
the Page.Control at the given index, the Page.Controls.Count decreases by
one.
Hearing such a problem first time. Try assigning the page count to a variable before starting the loop. ?
Seeing your base class design, I got confused. Why you need add the header like this ? if you know header should be there in all pages, why don't you add this in the design time itself ?
[edit]
One more point, I don't think ASP.NET can maintain viewstate for the dynamic controls added on page_load, because viewstate would be already loaded before page_load fires.
[/edit]
|
|
|
|
|
Hi..
Friends..
When I delete file with C# code, I m getting error like
"Access to the path 'g:\activewebroot\Active24\w11618838\web\content\File\xxx.zip' is denied."
But I can upload new files on server, But I cant delete this files !!
I dont know, Why this problem occurred ??
Please, Give me any solution ASAP.
Thanks in Advance.
Regards,
Abhi
|
|
|
|
|
Might be the file is open or in use close that file before trying delete that file
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
No, Sandeep !!
Not any files are open on the server.
In my project, I have a admin panel..
With this, I m uploading file, and it uploads successfully...
And Then, I m listing all files name and with button 'delete' for each file !!
But when, I click on 'delete' button , I am deleting files from server by C# code..Then I got this error !!
Regards,
Abhi
|
|
|
|