|
int length = FileUpload1.PostedFile.ContentLength;
byte[] pic = new byte[length];
FileUpload1.PostedFile.InputStream.Read(pic, 0, length);
SqlConnection con = new SqlConnection("connecstr");
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "spa";//stored procedure
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@a", pic);
cmd.Connection = con;
cmd.ExecuteNonQuery();
cmd = new SqlCommand("select * from a", con);
byte[] pic1 = (byte[])cmd.ExecuteScalar();
MemoryStream ms = new MemoryStream();
ms.Write(pic1, 0, pic1.Length);
Bitmap bmp = new Bitmap(pic1);
bmp.Save(Response.OutputStream, ImageFormat.Gif);
con.Close();
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
This is for conversion only.After converting the byte i want to display it into an asp image controlproperty of imageurl.
|
|
|
|
|
the code i delivered , will save the file to ur hard disk, now create an another aspx page and there display the image (he image which u created ), afterwards , give the link of that page in ur image control url property
Hope this will work
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Thanks For Ur Relpy
Actually i want to display the image in the same page itself on the same control.Because the actual functionality is when i select a row in a grid the grid row details will be diaplyed on the controls allowed.So i want to display the image in the image control itself.So plz gave the code for that.
|
|
|
|
|
byte[] im = (byte[])insunit.GetLogo(id);
MemoryStream ms = new MemoryStream();
ms.Write(im, 0, im.Length);
Bitmap bm = new Bitmap(im);
bm.Save(Response.OutputStream, ImageFormat.Jpeg);
//Img_Logo.ImageUrl=;
public byte[] GetLogo(string Id)
{
byte[] s;
string sqlstatement = "SELECT UnitLogoPath FROM Units WHERE UnitId='" + Id + "'";
s = (byte[])dbtObj.GetColumnValue(sqlstatement, "UnitLogoPath");
return s;
}
This is the code given when binding a grid.That means whn selecting a row the details of the row will display.What cahnge i want to gave to display the image in the Img_Loge.ImageUrl.
|
|
|
|
|
Display the image in another aspx page and and url will become that page.
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
I told u madam i want to display the image not in anotehr page but in the same page itself....i attach the code also to u people.So plz help me by go through the code.
|
|
|
|
|
Abay Dhakan , In order to make the image appear into the image control , it is mandatory to display it in a blank aspx page and afterwards give the imageurl , the address of that page(where u have to display the image).
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
|
|
|
|
|
Wow - this is so wrong. If he saves the file to disc, he can put an image control anywhere he likes. Not saving it to disc is his core question.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
The only way to do this, is to write an HTTP handler for a custom extension, which loads your image and feeds the bytes back. Otherwise, the image needs to be a file on your hard drive, not just a byte stream.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How it done please help...
|
|
|
|
|
can any one help me how to create pdf from database content using iTextSharp dll
|
|
|
|
|
Hi All,
I am using label and Button in templatecolumn of datagrid by checking some conditions,if Label is display, I want to disable the editcommand column buttons for the corresponding rows.
How Can i do this,Plz help me
Thank& Regards
Vijay s
|
|
|
|
|
I have two type User, customers and admins. there is two different table.with "Forms Authentication", I must declare (for example) :
<configuration>
<system.web>;
<authentication mode="Forms">
<forms>
name=".MyCookie"
loginUrl="/login/mylogin.aspx"
protection="All"
timeout="80"
path="/"/>
after login when I call this code : FormsAuthentication.RedirectFromLoginPage(UseName,false);
How can I detect Admin from Customer?
How Can I have two login page and how can I use "Forms Authentication" in this way. (my customers and Dmins have roles)
|
|
|
|
|
Your design is broken. You should have one table, of all people who can possibly log in. Then your site should support roles, and only show options to a logged in user who has permission to see them.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I have enabled deleting with a DetailsView. In the view I am displaying all the fields in a table except the primary key (a GUID). I am having a hard time writing the DeleteCommand. Using the primary key in my WHERE clause would be easiest, but where can I get it?
Is there a way to select the key, but not display it, and retrieve it as a parameter for my DeleteCommand? Is there a better/preferred way to determine the row to delete?
Thanks
|
|
|
|
|
What about adding one column in DetailsView? you can hide that column..
|
|
|
|
|
Hi all, I'm using CrystalReport 10 in asp.net 2.0.
I need to develop an application where the final user can modify the the crystal designer at runtime. Can anyone tell me how can i do this?
|
|
|
|
|
Following is the expression , that represents the trimming of the string , which has the white space.
function LTrim( value )
{
var re = /\s*((\S+\s*)*)/;
return value.replace(re, "$1");
}
function RTrim( value )
{
var re = /((\s*\S+)*)\s*/;
return value.replace(re, "$1");
}
function trim( value )
{
return LTrim(RTrim(value));
}
and am unable to understand the meaning of the expression
/\s*((\S+\s*)*)/
Will somebody please make me understand
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Tuesday, January 01, 2008 6:38:17 AM
|
|
|
|
|
the first \s* leaves any number of blank spaces
the inner one (\S+\s) matches one more non space characters and a space.. for example.. "asm " or "a " etc.
And the outer ((\S+\s)*) matches any number of these words..
in short, this regex breaks a sentence into words..
for ex. " My Name Is ABC XYZ"
can be extracted as "My_", "Name_", "Is_", "ABC_"
XYZ isn't captured because it does not have a trailing space and so doesn't match (\S+\s)
Regards,
Usman Munier
Xavor Corporation Pakistan
|
|
|
|
|
i was trying to figure out the solution of trimming.
i reached the following expression
function ltrim(s)<br />
{<br />
var temp = s;<br />
alert('hi');<br />
var obj = /^(\s*)([\W\w]*)/;<br />
if (obj.test(temp)) <br />
{<br />
temp = temp.replace(obj, '$2'); <br />
}<br />
return temp<br />
}<br />
<br />
function rtrim()<br />
{<br />
var temp = s;<br />
alert('hi');<br />
var obj = /^([\W\w]*)(\s*)$/;<br />
if (obj.test(temp)) <br />
{<br />
temp = temp.replace(obj, '$2'); <br />
}<br />
return temp<br />
}<br />
<br />
function trim(s)<br />
{<br />
return rtrim(ltrim(s));<br />
}
I think there is missing something.
One more thing , What is the difference between $1 and $2.
Please help
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Tuesday, January 01, 2008 8:07:19 AM
|
|
|
|
|
i have a better solution which i have verified as well on my many application try this.
i hope this will solve your problem
function TrimWhiteSpaces(s)
{
s=s.replace(/^\s+|\s+$/g, "");
var myArray=s.split(" ");
var outPut="";
for (var i=0;i&lt;myArray.length;i++)
{
if(myArray[i]!="")
{
outPut=outPut +" "+ myArray[i];
}
}
s=outPut;
return s;
}
wish you all the best
Usman Munier
Xavor Corporation Pakistan
|
|
|
|
|
What's the problem in the following chunk of code (i don;t have any problem regarding Left Trim )
function rtrim(s)<br />
{<br />
var temp = s;<br />
var obj = /([\W\w]*)(\s*)$/;<br />
if (obj.test(temp)) <br />
{<br />
temp = temp.replace(obj, '$2'); <br />
}<br />
return temp<br />
}
Yesterday is a canceled check. Tomorrow is a promissory note. Today is the ready cash. USE IT.
modified on Wednesday, January 02, 2008 12:14:43 AM
|
|
|
|
|
Hi,
In my application I am using a function that is currently written in the app_code directory.
This function called GetRole() gets the role of the logged-in user from the database table.
The function is called from almost all of the pages and user controls in my application
both on Page Load as well as on the PostBack events such as the click of a button etc.
Now is it possible that I get the Users Role only once when the user launches the
application and store it across all pages in my application.
We are not allowed to use sessions. Any ideas would be appreciated.
Thanks in advance,
Aakar
|
|
|
|
|
You can store it in Cookies or Cache.
aakar wrote: We are not allowed to use sessions.
Why are you not allowed to use Sessions?
|
|
|
|