|
System Error Message?
---------------------------------------------------
|
|
|
|
|
hai,
yes system handling error.like exception ......shows in an alert box not the thing that we want..
alex
|
|
|
|
|
Apart from registering the script are you doing any thing else ?
means logging the error something like that ?
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... "
|
|
|
|
|
|
If you are using updatepanels I don't think the script will get registered with the script manager on postback as the page is already rendered.
What you want to try is register the script as a function function ShowMyError( message) {...} on PageLoad, and then, in your Exception handler, call the function
<br />
ClientScript.RegisterStartupScript(this.GetType(), "AnyKey", "ShowMyError('dont do this ?');",true); <br />
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
hi,
what i did ,
in the page load
ClientScript.RegisterStartupScript(this.GetType(), "AnyKey", "function show(msg){ alert(msg);}");
and in the catch block\
ClientScript.RegisterStartupScript(this.GetType(), "AnyKey", "show('dont do this ?');", true);
it's not work
alex
|
|
|
|
|
Guessing a little here but try using the ScriptManager, as this lets you specify a control..
<br />
ScriptManager.RegisterStartupScript(yourUpdatePanel, page.GetType() , "AnyKey", "show('dont do this ?');", true); <br />
I just found this[^] as well. It might help. Make sure you post the solution - I need someting similar, but can't get to dev box at the moment!
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"I haven't spoken to my wife now for 48 hours. I don't like to interrupt her.
|
|
|
|
|
i am developing application in ASP.Net with C#. i am using button for FileOpenDialog to browse any image from hard drive as follows
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
problem is:
i want the browsed image to be copied in local hosti.e,""C:\\Inetpub\\wwwroot\\15 WebSite\\images\\1.jpg"
i have the follwing idea in mind
File.Copy("C:\\Inetpub\\wwwroot\\15 WebSite\\images\\1.jpg", "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\xyz.jpg");
or
File.Copy(s.Substring(13,s.Length-13), "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\xyz.jpg");
but i dont want to existing image to be overwrite, i want all images to ve saved in local host
can anyone sugesst me what to do?
|
|
|
|
|
But what if the user(client) wants to copy a file from its machine to server
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... "
|
|
|
|
|
but my requirement is that in Windows application user is browsing image and clicking the "save" button to save it in database, i have to lauch the same image in website to i want the image to be copied in local host, can u suggest any solution for that
|
|
|
|
|
mavii wrote: my requirement is that in Windows application user
But in your first query you posted that you are developing asp.net application . i don't have much idea about that but post your queries in right forum
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... "
|
|
|
|
|
mavii wrote: but my requirement is that in Windows application user is browsing image and clicking the "save" button to save it in database,
Is images are stored in database ?
mavii wrote: i have to lauch the same image in website to i want the image to be copied in local host, can u suggest any solution for that
Still I am not getting what you mean by this.
1 - Why user is browsing image from an windows application
2 - From where the user comes ? If the user is coming from another system, how can you copy the file to your local drive ?
Please make your question more clear
|
|
|
|
|
actually i am developing two applications for the same organization using a single database, i am saving the record of "Wanted Criminals" in my wndowos application. the user of windows application opens a page to insert the record of new criminal, user also saves the picture of criminal using "FileOpenDialog" to browse any image saved in hard drive, so in database the path of "wanted criminal" is saved along with criminal names, age etc.
problem is that in my website i want to display the picture of "Wanted criminal" along with his other information in da Datagrid, but in databast the path of Picture is saved as "E:\criminals\abc.jpg". website can display images placed in local host, so i wanted the image whom path is being saved in database through windows application should be copied with same name in "C:\Inetpub\www.root" have u got my problem
can u plz suggest any solution?
|
|
|
|
|
mavii wrote: user also saves the picture of criminal using "FileOpenDialog" to browse any image saved in hard drive, so in database the path of "wanted criminal" is saved along with criminal names, age etc.
Problem resides here. Because the file is in remote machine who uses the windows application. And you are trying to see that in your local ASP.NET application. This is not possible since you don't have a virtual path access to the file. Copying file from that machine to local machine is also not a good solution.
You can solve this by keeping image in database as BLOB data. Check this[^] to get started with that.
Hope this helps
|
|
|
|
|
ur idea must be right but i cant try it now, i have tried a method, can u plz suggest solution regarding this problem
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
string st = "abc1" + (count++) + ".jpg";
File.Copy(s.Substring(13, s.Length - 13), "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\" + st);
the subctring exactly returns the name og the picture
PROBLEM IS:
i want the image to be saved with the same name in local host as the Substing retun name "ABC.jpg" i want to save it with the same name in local host
|
|
|
|
|
can u suggest a solution for following problem
public static int count = 0;
private void button3_Click_1(object sender, EventArgs e)
{
openFileDialog1.ShowDialog();
string s = openFileDialog1.FileName;
textBox6.Text = s;
string st = "Pict" + (count++) + ".jpg";
File.Copy(s.Substring(13, s.Length - 13), "C:\\Inetpub\\wwwroot\\15 WebSite\\images\\" + st);}
i want the image to be saved in local host with the same name as as it was present in hard drive (from where it was browsed)
ur solution regarding BLOB must be right but i cant apply it right now
|
|
|
|
|
As you are creating an ASP.NET application so I would suggest you to use FileUpload control to upload the said file to your server’s working directory. Here is a small example which does that:
protected void UploadButton_Click(object sender, EventArgs e)
{
if(FileUploadControl.HasFile)
{
try
{
if(FileUploadControl.PostedFile.ContentType == "image/jpeg")
{
if(FileUploadControl.PostedFile.ContentLength < 102400)
{
string filename = Path.GetFileName(FileUploadControl.FileName);
FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
}
else
StatusLabel.Text = "Upload status: The file has to be less than 100 kb!";
}
else
StatusLabel.Text = "Upload status: Only JPEG files are accepted!";
}
catch(Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
Regards,
Amit Pal
|
|
|
|
|
but my requirement is that in Windows application user is browsing image and clicking the "save" button to save it in database, i have to lauch the same image in website to i want the image to be copied in local host
"Server.MapPath" doesent work in Wndows application
|
|
|
|
|
Hi,
I am working on one application in asp.net and it requires file uploading(word documents)...
I am able to upload and save it in database...
I am using Sqlserver2005 and i took datatype image to store the uploaded file..
The document is storing in binary format in database...
Now,i want to retrieve the document in a Textbox which i am not able to do...
This is the code i used for fileuploading...
if (FileUpload1.FileName != "")
{
Stream ImageStream;
int intImageSize = FileUpload1.PostedFile.ContentLength;
byte[] ImageContent = new byte[intImageSize];
ImageStream = FileUpload1.PostedFile.InputStream;
int intStatus;
intStatus = ImageStream.Read(ImageContent, 0, intImageSize);
try
{ con.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "Image_table";
SqlParameter p = new SqlParameter();
p.ParameterName = "@Content";
p.SqlDbType = SqlDbType.Image;
p.Value = ImageContent;
cmd.Parameters.Add(p);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
con.Close();
}
}
Using this code the uploaded file is stored in the database in binary format...
Now i want to retrieve it...
can any one help me in doing this...
-- modified at 5:27 Thursday 20th September, 2007
|
|
|
|
|
|
Hi Navaneeth,
Thanks for ur reply,
I already worked on what you had sent...
I am able to get the images but i need MS-Word Document...
can u suggest me which is the better way to show the word document...
For Eg:
when u visit naukri.com and click on register u will fill all the details and
upload resume...and when u want to update the resume, u will see it in a
textbox(multiline).
I am able to store the uploaded file in the database,but not able to retrieve
it from database and show the content in the textbox
If you have any ideas then plz send me.
Thank You,
Rajesh
|
|
|
|
|
honeysip wrote: I am able to store the uploaded file in the database,but not able to retrieve
So you need to show the contents to a text box ? Right. Try saving the file after reading from database to a temporary place. Then read it from there. Read contents to a byte array and save it using FileStream object. Then try reading file from that location. But still I am not sure that you can read a word file using StreamReader without loosing the formatting !
|
|
|
|
|
hi guys,.
i have one doubt friends.. I create one .net application. its run fine but in future i want to add new functionality to my old application to perform faster and robustness.. in this situation my client wants to migrate old version to new version.. how to solve this problem bcoze my client in abroad i am in india..
rply me!!
|
|
|
|
|
You just need to install the version of .NET framework along with VS version(to which you are looking to upgrade). Thereafter, you can migrate your earlier projects to the new version by some easy steps.
If this does not solve this issue, then please give a detail description of your requirements.
Regards,
Amit Pal
|
|
|
|
|
hi.. In my side no problem, but my abroad client wants to switchover to new version.. for eg:- my client working with old version ref by(1.0.0.1) but i develope that application with extra features last one year.. in this situation my client approach me to migrate new version ref by(1.0.1.0)..
so how to solve this problem..
|
|
|
|