|
Hey.
I have one table in MySql Database.
I have two field.
documentBinary LongBlob
documentContentType varchar
My code to download file.
byte[] data = (byte[])Dt.Rows[0]["documentBinary"];
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearHeaders();
response.ClearContent();
response.Clear();
response.ContentType = Dt.Rows[0]["documentContentType"].ToString();
response.AppendHeader("Content-Disposition",
"attachment; filename=" + Dt.Rows[0]["titel"].ToString() + ".pdf; size=" + data.Length.ToString());
response.BinaryWrite(data);
response.Flush();
response.End();
When I download file,File is downloaded successfully but not open in pdf format.
Please look at my code and tell me where I am going wrong.
Thanks
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Whether PDF is installed in your system.
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
Yes. It is installed. When I open file it shows me that file is corrupted.
Thanks
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Check by check points and find can u you able to retreive the data from MYSQL.
Sathesh.
Blessed is the season which engages the whole world in a conspiracy of love.
|
|
|
|
|
Sathesh Sakthivel wrote: Check by check points and find can u you able to retreive the data from MYSQL.
Everything works file, file is created also, but does not open. It shows me that file is corrupted or not supported.
please don't forget to vote on the post that helped you.
|
|
|
|
|
I have a question.. I am trying to add items to a dropdownlist or select box and then when someone pushes the submit button (ASP.net button) it gets the list of items.
The problem is it doesn't work like that. It doesn't see any of the items. What I am doing is populating one dropdownlist with peoples names and email addresses from active directory (name == text, email == value). When you select the name and click add (HTML button) it adds the email to my other dropdownlist with javascript:
function btnAddEmail_onclick() {
var cbCCEmails = document.getElementById("cbCCEmails");
var dropUserEmails = document.getElementById("<%= dropUserEmails.ClientID %>");
var SelectedIndex = dropUserEmails.selectedIndex;
var Email = dropUserEmails(SelectedIndex).value;
var Name = dropUserEmails(SelectedIndex).text;
if (SelectedIndex != -1)
{
cbCCEmails.options.add(new Option(Email, Name));
dropUserEmails.remove(SelectedIndex);
}
}
Now the code you see above takes the name from one box and adds the email to another one (cbCCEmails).
Now in the code behind im trying to loop through each ListItem. What I am tryign to do is CC all the emails in that listbox:
for (int i = 0; i < cbCCEmails.Items.Count; i++)
{
if (String.IsNullOrEmpty(CCEmails))
CCEmails = cbCCEmails.Items[i].Text;
else
CCEmails += "," + cbCCEmails.Items[i].Text;
mm.CC.Add(new MailAddress(cbCCEmails.Items[i].Text));
}
Please ignore the CCEmails string.. that is used for inserting into a database.
I understand that i am losing the values on postback beacuse of the button, but how do I retain those values? ViewState is enabled but autopostback is not since im adding it with javascript. Teh reason I am using javascript on that side is because posting back takes to long and is slow
|
|
|
|
|
Use hidden variables for your scenario.Assign the values from javascript and you'll able to access from codebehind also.
Cheers!!
Brij
|
|
|
|
|
I'm more of a windows developer.. so I take it hidden variables is saving the results to one textbox or something?
So each time someone adds the email, append it to a textbox, then on the postback get the items from the textbox and split it by a comma (if that is how I seperated them)?
|
|
|
|
|
I can't find wizard control in tool box [Visualstudio2008].
I have already added it but not showing in my tool box.
please advice
|
|
|
|
|
See the following.It might be of help
Click here
Cheers!!
Brij
|
|
|
|
|
He is talking abt Web Application And You are talking abt Windows application..! check your answer..!
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
You No need To add it will come under Login Controls..!If it not there u need to repair the Visual studio..!
You are talking abt web application right?
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
Originally I had planned to use Dreamweaver CS4 for general website design, layout, and master pages (and then transfer into VWD, but after watching several awesome tutorial videos on designing website using Visual Studio 2008, I want to give VWD a try before jumping to Dreamweaver.
Then there's Adobe Fireworks, though designed to function very well with Dreamweaver, seems to be a great tool in its own right. My question is how well does Adobe Fireworks works with Visual Studio 2008? Or is there a graphic designer out there that goes along better with VWD?
I'd greatly appreciate for any suggestions.
Thanks!
|
|
|
|
|
Fireworks is simply a graphics package (or at leats it used to be) which is used to generate images. This has absolutely nothing to do with the tools you use to design your web pages. What graphics tool you use is down to persobal choice, at the end of the day they just create images.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello friends,
I want to access C# dll functions from javascript. Can any one tell me steps to do it?
Thanks
Amit
|
|
|
|
|
You can do it using ActiveX Components. But this will work only on IE .
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
If you use Ajax you can make calls to a web host if the C# dll accepts post request, you can translate your requests through an ASP.NET page, or if you use Silverlight you can interact with silverlight from Javascript. Each choice has pro's and con's.
If you really want seamless interaction, use Java and Live Connect.
|
|
|
|
|
Create one HttpHandler, in that reference the dll and do all you need in ProcessRequest.
From javascript, call the handler to fetch the response.
If you want to use Javascript to access WebMethod, you can also do that using PageMethod, for which you need to expose the methods as Web Service.
Take a look into this :
http://forums.asp.net/p/1266663/2382644.aspx[^]
|
|
|
|
|
Hi experts ,
Is there any way to use "System.Web.UI.ScriptManager" in FW2.0..is there any alternative control for this ?
|
|
|
|
|
I think if you install AJAX framework, it will work in Framework 2.0...
|
|
|
|
|
Hi, I have to download a doc file and show the pdf file in the browser. For that I have used the following code in JavaScript of the button click
window.open(url, 'Download', 'height=1,width=1,top=0,left=-1000');
where url represent the path of the file (http://localhost/website/filename.doc).I do not want to show the popup window, for that I have used left=-1000, but it does not effect. Do you have any idea how I can hide that popup window
Pankaj
|
|
|
|
|
Does anyone have the solution
Pankaj
|
|
|
|
|
Hey, I have created following code. But button event is not firing. Please look at the code and tell me where I am doing wrong.
namespace immu.control
{
[ToolboxData("<{0}:myControl runat=server></{0}:myControl>")]
public class docControl : WebControl
{
public Button btn;
protected override void CreateChildControls()
{
Panel pnl = new Panel();
btn = new Button();
btn.Text = "Click Me";
btn.Click += new EventHandler(btn_Click);
pnl.Controls.Add(btn);
this.Controls.Add(pnl);
}
public void btn_Click(object sender, EventArgs e)
{
HttpContext.Current.Response.Redirect("http://google.com");
}
}
}
Thanks.
Imrankhan
please don't forget to vote on the post that helped you.
|
|
|
|
|
The problem is solved.
Thanks.
please don't forget to vote on the post that helped you.
|
|
|
|
|
Hi,
I am working on ASP.NET(c#)/SQL Server project. I my project i want to have the textbox to show the text like the text in "SQL Script".
e.g: When we write the query in sql Server the color of reserved words (like "select", "where" etc) changes to blue, the color of commented lines changes to green and the other text remains the same.
Please guide me how to do this.
Sonia
|
|
|
|