|
yes sir complete source code of the page which i loaded in the iframe.plz help in this regard
|
|
|
|
|
Tru to use this u will get.
function viewSource()
{
d=window.open();
d.document.open('text/plain').write(document.documentElement.outerHTML);
}
Devjit Das.
|
|
|
|
|
thanks u sir its working.m getting complete source code.
|
|
|
|
|
sir frame1.document.documentElement.outerHTML the complete code is comming ,but now i want i click a button preview
the html page should come how copuld be possible
|
|
|
|
|
hi frindz
i have problem n need ur help
i am developing an application with asp.net along with c#.net using sqlserver2005 as db
i want to add a image in the database.
maeans i want to keep the path of image from where it is updated.and want to keep the
image in seperate folder with iin the application name image.
can you tell me what wil be code to " upload a picture in my application and then store the path name in the db and the image in a seperate folder inside my application"
thanks in advance
biswa007
|
|
|
|
|
Hi
Just use File upload control that will upload the image that you want to update.
Regarding the file path FileUpload1.PostedFile.FileName will give you full path path of file from client machine
Google the subject you will find more articles on this topic
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... "
|
|
|
|
|
this will help, you to upload image........
and Store the path in database
protected void Button2_Click(object sender, EventArgs e)
{
string sSavePath;
string sThumbExtension;
int intThumbWidth;
int intThumbHeight;
sSavePath = _Default.fullpath;
sThumbExtension = "_thumb";
intThumbWidth = 160;
intThumbHeight = 120;
// If file field isn’t empty
if (FileUpload1.PostedFile != null)
{
// Check file size (mustn’t be 0)
HttpPostedFile myFile = FileUpload1.PostedFile;
int nFileLen = myFile.ContentLength;
if (nFileLen == 0)
{
lblOutput.Text = "No file was uploaded.";
return;
}
// Check file extension (must be JPG)
if (System.IO.Path.GetExtension(myFile.FileName).ToLower() != ".jpg")
{
lblOutput.Text = "The file must have an extension of JPG";
return;
}
// Read file into a data stream
byte[] myData = new Byte[nFileLen];
myFile.InputStream.Read(myData, 0, nFileLen);
// Make sure a duplicate file doesn’t exist. If it does, keep on appending an
// incremental numeric until it is unique
string sFilename = System.IO.Path.GetFileName(myFile.FileName);
int file_append = 0;
while (System.IO.File.Exists(( (sSavePath + sFilename))))
{
file_append++;
sFilename = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
+ file_append.ToString() + ".jpg";
}
// Save the stream to disk
System.IO.FileStream newFile
= new System.IO.FileStream((sSavePath + sFilename),
System.IO.FileMode.Create);
newFile.Write(myData, 0, myData.Length);
newFile.Close();
// Check whether the file is really a JPEG by opening it
System.Drawing.Image.GetThumbnailImageAbort myCallBack =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
Bitmap myBitmap;
try
{
myBitmap = new Bitmap((sSavePath + sFilename));
// If jpg file is a jpeg, create a thumbnail filename that is unique.
file_append = 0;
string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName)
+ sThumbExtension + ".jpg";
while (System.IO.File.Exists((sSavePath + sThumbFile)))
{
file_append++;
sThumbFile = System.IO.Path.GetFileNameWithoutExtension(myFile.FileName) +
file_append.ToString() + sThumbExtension + ".jpg";
}
// Save thumbnail and output it onto the webpage
System.Drawing.Image myThumbnail
= myBitmap.GetThumbnailImage(intThumbWidth,
intThumbHeight, myCallBack, IntPtr.Zero);
// myThumbnail.Save((sSavePath + sThumbFile));
Image1.ImageUrl = @"~\" + (string)Session["user_name"].ToString() + @"\" + sSavePath + sFilename; //+ sThumbFile;
//Directory.GetCurrentDirectory() + @"\" + sThumbFile;
// Displaying success information
lblOutput.Text = "File uploaded successfully!";
TextBox3.Text = @"~\" + (string)Session["user_name"].ToString() + @"\" + sSavePath + sFilename;// sThumbFile;
// Destroy objects
myThumbnail.Dispose();
myBitmap.Dispose();
}
catch (ArgumentException errArgument)
{
// The file wasn't a valid jpg file
lblOutput.Text = "The file wasn't a valid jpg file.";
System.IO.File.Delete(sSavePath + sFilename);
}
}
}
public bool ThumbnailCallback()
{
return false;
}
and read in this way
Read image from database[^]
|
|
|
|
|
Assalam-0-Alaikum,
hru? well in .Net 2.0 there is a file upload control. put it on ur .aspx page. In code behind file
provide its id and press a dot(.). Now the real fun starts here.
--- to get file name :
dim fileName As String = FileUpload1.PostedFile.FileName
then u can use this string fileName to save it in the database using inLine Query or Stored Procedure etc. If u have Problem Inserting data in the database, do let me know. i would write u know how to do this.
-- to Save file in the specified Location:
FileUpload1.PostedFile.SaveAs("Location as string")
there are other properties and method for the fileupload control tht u could use but depend on the requirement.
Hope it Helps.
Regards.
Atif Ali Bhatti.
Software Engineer.
Esoul Consultancy Pvt. Ltd.
|
|
|
|
|
hai i am using the file upload control indotnet as told by you.but here i want store the path of the image where it woulb stored not where it was stored.
accaording 2 ur soln it stores the the path of the image from where it upload the image...so can u solve it.
|
|
|
|
|
Assalam-0-alaikum,
yes i would tell u. look its u who will decide where to store the file. like,
fileupload1.postedfile.saveas("c:\myweb\images\image1.jpg")
now save the same path in the database i.e., c:\myweb\images\image1.jpg
now Question arises how to differentiate files. give them a unique name.
now how to give a unique name? there are so many ways but how do i save is, i create a folder with the username, save the file and name it with the username concatenated with some other patameters to make it unique.
hope u get it.
Regards.
Atif Ali Bhatti.
Software Engineer.
eSoul Consultancy Pvt. Ltd.
|
|
|
|
|
I have a textbox and Button Search in the site A. When I input data in the TextBox and then click Button Submit I have data of Textbox input. However, when I use variable in the textbox of site A for site b then I meet error. If you know, tell me to process please,
thanks
RICHING MINDS,CHANGING LIVE
|
|
|
|
|
Hi phuhoa
In ASPX, variable not stored in a long time. Just whene the page is created. To use long life variable use session (however in default just 20 minuites).
Like the example:
First, store your variable
Session("textbox1") = textbox1.text
To retrieve it
textbox2.text = Session("textbox1")
Hope it is usefull for you.
|
|
|
|
|
I am confused can you tell me What is Site A and Site B
If both are different web application then pass the value in query string if you don't know how to pass the query string please google it
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... "
|
|
|
|
|
Hi Sandeep, Hi phuhoa
Query string is also a nice choice to "transfer" the variable. However, it is not really safe, when we deal with the security.
Let us follow the sample:
Me.TextBox1.Text = Request.QueryString.Get("prevpage").ToString
*Change the prevpage with the value of previous page.
Regards,
Riza Azmi
(rizaazmi@yahoo.co.id)
|
|
|
|
|
Yes its not Secured but i think in his application that is not main concern
as it is the value that user is going to enter i don't think it will cause any trouble or security concerned . If you change the the quesry string then result will different just simple
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... "
|
|
|
|
|
Sssssssssst...
The thread starter are sleeping.
|
|
|
|
|
I am really surprised the the owner of this thread is silver member he is member of CP since 2 years and this is his first post
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... "
|
|
|
|
|
hi
how to make Login Button to DefaultButton if i have use master page concept
Naresh Patel
|
|
|
|
|
Assalam-0-alaikum,
how r u? well ur .aspx page has a form tag. inside tht tag specify a property "DefaultButon = desiredbutton" and bhooop. the magic has happend. hope it helps. do let me know with ur feedback.
thnx
Atif Ali Bhatti.
Software Engineer.
Esoul Consultancy Pvt. Ltd.
|
|
|
|
|
how should i use the trim funciton in javascipt?I think a default function is not available in javascript to trim white spaces.
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Sonia Gupta wrote: I think a default function is not available in javascript to trim white spaces.
yes but you can make your own function
get it Trim function
bEst rEgard
pAthan
please don't forget to vote on the post that helped you.
|
|
|
|
|
Yes,There is no inbuilt Trim Function in javascript.
You should implement own function for the trim white space like this
function Trim(s)
{
// Remove leading spaces and carriage returns
while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
{ s = s.substring(1,s.length); }
// Remove trailing spaces and carriage returns
while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
{ s = s.substring(0,s.length-1); }
return s;
}
umesh
|
|
|
|
|
what's the meaning of the follwing line
s = s.substring(1,s.length);
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
|
Just use this code and enjoy urself.
// Removes leading whitespaces
function LTrim( value )
{
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
// Removes ending whitespaces
function RTrim( value )
{
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
// Removes leading and ending whitespaces
function trim( value )
{
return LTrim(RTrim(value));
}
// Call this Function
function Test()
{
var _test=trim(' Devjit Das ');
alert("'"+_test+"'");
}
Devjit Das.
|
|
|
|