Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to bring save as dialog box in asp.net

Status
Not open for further replies.

alex5935

Programmer
Oct 24, 2007
13
US
Hello is anyone know how to bring a save file as dialog box in ASP.net?

 
The following code should get you started:
(check out this site for more:
private void btnOpenFileDialog_Click(object sender, System.EventArgs e)
{
OpenFileDialog openFileDialog1 = new OpenFileDialog();
openFileDialog1.InitialDirectory = "c:\" ;
openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*" ;
openFileDialog1.FilterIndex = 2 ;
openFileDialog1.RestoreDirectory = true ;
if(openFileDialog1.ShowDialog() == DialogResult.OK)
{
fName = openFileDialog1.FileName;
showInfo();
sr = new StreamReader(fName);
}
}
 
Woops sorry didnt see you meant asp.net. You will have to invoke it through javascript:

<script language="JavaScript">
var isReady = false;
function doSaveAs(){
if (document.execCommand){
if (isReady){document.execCommand("SaveAs");}
}else{
alert('Feature available only in Internet Exlorer 4.0 and later.');
}
}
</script>

<a href="javascript:doSaveAs()">
Click Here To Save This Page
</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top