|
I don't think you can display excel file in modal dialog. Can't you use window.open() instead of window.showModalDialog() ?
If you need to use modal dialog, then put an iframe in your modal dialog page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModalDialogPage.aspx.cs" Inherits="ModalDialogPage" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Excel export</title>
<link type="text/css" rel="Stylesheet" href="ModalDialogPage.css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe name="excelExporter" src="excelExporter.aspx"></iframe>
</div>
</form>
</body>
</html>
note stylesheet file modalDialogPage.css:
body
{
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
border: none 0px #000000;
width:100%;
height:100%;
}
iframe
{
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
border: none 0px #000000;
width:100%;
height:100%;
scrolling:no;
frameborder ;
}
and then you can put your excel generating code into your excelExporter.aspx page.
should be working!
Pilo
|
|
|
|
|
I didn't completely understand what you are saying. But here is the problem I am facing. In the popup window I have the tag <base target="_self" />. THis tells the browser to display the results in the same window instead of opening in a new window. So when I do the export to excel it is not able to display the save/open dialog because of that. If I remove that tag, it is able to display that dialog but the problem is everytime I do a postback it opens the new window to display the results.
Thanks,
sridhar.
|
|
|
|
|
I have figured the solution for this. I have added onclick event to the excel button. The onclick event will open a new window using window.open method. In that new window I have the code that exports the data to excel.
Thanks,
sridhar.
|
|
|
|
|
Hi, I have tried to upload a file to a MySQL database for a week now and still have problems. Would you please check to see what is causing the exception "Invalid cast from System.String to System.Byte[]." The following are my code for uploading a file to the database. I would really like to know why its giving me that error message, thank you in advance for your help.
----------------------------------------------------------------------------------------------------------------------------------------
| Field | Type | Null | Key | Default | Extra |
----------------------------------------------------------------------------------------------------------------------------------------
| docID | int(11) | NO | PRI | NULL | AUTO_INCREMENT |
|
| docTitle | varchar(30) | NO | | NULL | |
|
| docContent | MediumBlob | NO | | NULL | |
|
| docDate | timestamp | NO | | CURRENT_TIMESTAMP | |
|
| docType | varchar(15) | NO | | NULL | |
----------------------------------------------------------------------------------------------------------------------------------------
Imports System.IO
Imports System.Data.Odbc
Public Class Upload
Inherits System.Web.UI.Page
Private Sub Submit1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Submit1.Click
Dim strFileEx As String
Dim StrFileType As String
Dim intFileLen As Integer
Dim objStream As Stream
Dim strInsert As String
Dim myConnection As OdbcConnection
Dim cmdInsert As OdbcCommand
If Not IsNothing(txtFileContents.PostedFile) Then
'Determines File Type
strFileEx = Right(txtFileContents.PostedFile.FileName, 4)
Select Case strFileEx.ToLower
Case ".doc"
StrFileType = "doc"
Case ".ppt"
StrFileType = "ppt"
Case ".htm"
StrFileType = "htm"
Case ".html"
StrFileType = "html"
Case ".txt"
StrFileType = "txt"
Case Else
StrFileType = "jpg"
End Select
'Grab the content of uploaded file
intFileLen = txtFileContents.PostedFile.ContentLength
Dim arrFile(intFileLen) As Byte
objStream = txtFileContents.PostedFile.InputStream
objStream.Read(arrFile, 0, intFileLen)
'Add UpLoaded file to a database
myConnection = New OdbcConnection("Provider=MySQLProv; Data Source=Data;User Id=myID;Password=myPWD")
strInsert = "INSERT into QUsers (docTitle,docContent,docDate,docType) values (?,?,?,?,?)"
cmdInsert = new odbcCommand(strInsert,myConnection)
cmdInsert.Parameters.Add("@docID",OdbcType.int,30)
cmdInsert.Parameters["@docID"].Values =""
cmdInsert.Parameters.Add("@docDate", OdbcType.TimeStame,14)
cmdInsert.Parameters["@docDate"].Values = DateTime.Now.ToShortDateString()
cmdInsert.Parameters.Add("@docTitle", OdbcType.Varchar,30 )
cmdInsert.Parameters["@docTitle"].Values = txtFileTitle.Text
cmdInsert.Parameters.Add("@docType", OdbcType.Varchar,30)
cmdInsert.Parameters["@docType"].Values =StrFileType
cmdInsert.Parameters.Add("@docContent",OdbcType.Text)
cmdInsert.Parameters["@docContent"].Values =arrFile
myConnection.Open()
cmdInsert.ExecuteNonQuery()
myConnection.Close()
End If
End Sub
End Class
|
|
|
|
|
Hi,
Your parameter "@docContent" its datatype should be OdbcType.Binary or OdbcType.VarBinary.
Coz these two datatypes are mapped to an array of Byte.
I hope this will help you.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
I have changed that error you have pointed out but I still get the same error message. The change from Odbctype.Text to OdbcType.Binary had been made for @docContent and still VS2003 throws the same exception. I don't know what else to do, all of the other variables have been checked for invalid type
casting and I don't see any. Please help me spot the error. Thank you in advance for your help.
-- modified at 23:29 Thursday 7th June, 2007
|
|
|
|
|
Hi,
R u getting the same error at the same line as previous one?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
Yes, I get the same error message as before. I even tried changing Binary to VarBinary and that didn't help either. Please take at look at my code for me to see where the problem is. VS2003 says it's the line that says cmdInsert.ExecuteNonQuery() that is causing the problem and it marked that line red. Is there anyway that you can run my code to see where the problem is? Please help me solve this problem, I ran out of ideas. Thanks again for your time.
-- modified at 11:42 Friday 8th June, 2007
|
|
|
|
|
|
my cookie object is deleted when i run application at second time. why? though i gave expiry days.
|
|
|
|
|
are you overwriting some blank data at second time?
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi ,
I would like to add item in web control RadioButtonList using java script .
Any help is appriciated.
Regards
Rajesh
rajesh
|
|
|
|
|
function RadioChecked(param)
{
{
var frm = document.forms[0];
// Take all elements of the form
for (i=0; i < frm.length; i++)
{
// itinerate the elements searching "RadioButtons"
if (frm.elements[i].type == "radio")
{
// Unchecked if the RadioButton is != param
if (param != frm.elements[i].id )
{
frm.elements[i].checked = false;
}
}
}
}
}
Regards,
Satips.
|
|
|
|
|
Thanks Satips,
But my question is how to add item in RadioButtonList .
Like I write a code in code behind .cs file
RadioButtonList.item.add(a);
RadioButtonList.item.add(b);
RadioButtonList.item.add(c);
RadioButtonList.item.add(d);
RadioButtonList.item.add(e);
Similarly , i want to add item in RadioButtonList using java script.
How can i do it?
Regards
Rajesh
rajesh
|
|
|
|
|
What method do you think is better when there are many threads?
Regards,
Analizzatore Cloro
|
|
|
|
|
You can't do that. The RadionButtonList control doesn't exist in the browser, it only exists on the server while the page is created.
As what you are asking for is impossible, what is it that you want to accomplish?
---
single minded; short sighted; long gone;
|
|
|
|
|
You cannot do as how you have stated for the Radio Button list.
Since the Radio buttonlist control exist on the server side while the page is creatred this method is impossible.
so go with the method as how i have stated before.
Regards,
Satips.
|
|
|
|
|
hi all, i want to make a simple project, i want to put a dropdown list to make a list of the countries's times as the one you can see on the time zoon on the windows.
-- modified at 7:44 Thursday 7th June, 2007
Thanks alot
Hamody
|
|
|
|
|
One option is to enumerate the subkeys of
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
hi, thanks a lot for urhelp but mayu give me a code sample cause i didnt understand how 2 do it.
Thanks alot
Hamody
|
|
|
|
|
how to fix the size and position of text box or other control that size would not be changed?
|
|
|
|
|
|
just give some values the its properties according to your requirements
|
|
|
|
|
I have the master page having middle part as content template and on left and right
on master page I am displaying images which are changing on each refreshment.
In IE if I refresh the page it comes to master page pageload event (Postback=false)
and executes the functions (for displaying the images right and left )in condition postback==false
In IE it comes ones on this page(master page) BUT IN MOZZILLA if I refresh the page it comes two times on pageload and execute that functions two times on page load of master page....and changed images that i bind to repeater to display is not diplayed ...
sjs
|
|
|
|
|
I am displaying multiple rows and columns in a table dynamically i want to keep page index or next previous link to the table with out using grid, but the functionality must be like page indexer in grid view
|
|
|
|