|
You could find you answers at Chris Khoo post
http://www.codeproject.com/aspnet/netimageupload.asp
Based in that post i made these two functions for asp.net C#.
you must to invoice the public function. The parameters are:
MaxWidth = max Width pixels
MaxHeight = max height pixels
UrlAndFileName = the From address image
UrlAndNewFileName = the save address and new file name
Example: (600, 600, "C:\Documents and Settings\Barriosj.FMMB\Mis documentos\Mis imágenes\imagenes\73237_4611.jpg", "c:/myRedimImage.jpg")
The image is restricted by the smallest width or heigth value.
public void Redim_And_SaveImg(int MaxWidth, int MaxHeight, string UrlAndFileName, string UrlAndnewFileName)
{
// load up the image, figure out a "best fit"
// resize, and then save that new image
Bitmap OriginalBmp = (System.Drawing.Bitmap)Image.FromFile(UrlAndFileName).Clone();
Size ResizedDimensions = ObtainDim(MaxWidth, MaxHeight, ref OriginalBmp);
Bitmap NewBmp = new Bitmap(OriginalBmp, ResizedDimensions);
NewBmp.Save(UrlAndnewFileName, System.Drawing.Imaging.ImageFormat.Jpeg);
}
private static Size ObtainDim(int MaxWidth, int MaxHeight, ref Bitmap Bmp)
{
int Width;
int Height;
float Multiplier;
Height = Bmp.Height;
Width = Bmp.Width;
// this means you want to shrink
// an image that is already shrunken!
if (Height <= MaxHeight && Width <= MaxWidth)
return new Size(Width, Height);
// check to see if we can shrink it width first
Multiplier = (float)((float)MaxWidth / (float)Width);
if ((Height * Multiplier) <= MaxHeight)
{
Height = (int)(Height * Multiplier);
return new Size(MaxWidth, Height);
}
// if we can't get our max width, then use the max height
Multiplier = (float)MaxHeight / (float)Height;
Width = (int)(Width * Multiplier);
return new Size(Width, MaxHeight);
}
keep Learning and you never will be out of date...
|
|
|
|
|
I have a problem in datagrid.
what i have to do, i have to display a record in datagrid from databse.
i have a feild status in my same table , i have to check if status has 0 then it must display "No" in the status field, and "Yes" if status value is 1.
plz tell me how can i do it.
any suggestion.
|
|
|
|
|
This you can do in OnItemDataBound event of the datagrid. There you have to check the value coming from the database and display the message accordingly..
Best Regards,
Apurva Kaushal
|
|
|
|
|
hi
thanx for reply,
didn't get u much, plz could u send some code for it.
thanx
waiting for the reply
|
|
|
|
|
In the OnItemDatabound(this gets executed for each and every row of the datagrid) event first you have to get the value and depending upoin it you can display the message what you want. Sample code
public void test(object sender, DataGridItemEventArgs e)<br />
{<br />
<br />
if(e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)<br />
{<br />
DataRowView drv = (DataRowView)e.Item.DataItem;<br />
if(drv["Yourcolumnname"].Tostring() == "0")<br />
{<br />
}<br />
else<br />
{
}<br />
}
Best Regards,
Apurva Kaushal
|
|
|
|
|
Private Sub grdTest_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdTest.PreRender<br />
<br />
Dim item As DataGridItem<br />
<br />
For Each item In grdTest.Items<br />
item.Cells(1).Text = IIf(item.Cells(1).Text.ToUpper = "TRUE", "Yes", "NO")<br />
Next<br />
End Sub
=postmaster
http://www.programmingknowledge.com/[^]
|
|
|
|
|
yes its working
thanx u very much.
byee
tc
|
|
|
|
|
HI all
I have 2 webforms which collect data from client and insert into DB
When the user complete the 1st form details and enter into second form if he wants to come back to 1st page to modify
I want to put a BACK button which should return all 1st page data as it is he enter in the textboxes
How can i store the data without using the sessions
THX
asdfasdfasdfasdfasdfasdfasdfasdfasdfasdf
|
|
|
|
|
If the data is less and not very important then you can send through querystring also.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hello,
please give the details Difference b/w DataGrid and Dataset..
|
|
|
|
|
Dataset is a set of records which are retrieved from the database. The DataAdapter fills the data into dataset and whatever changes which are made to the dataset gets updated in the database with the help of dataadapter.
Datagrid is one of the web controls which makes use of the dataset to store data into it.
Thanks & regards,
Suresh Dayma
Everything Is Possible!
|
|
|
|
|
A dataset holds data in memory, often loaded from a dataabse
A datagrid displays data, often held in a dataset.
|
|
|
|
|
hi
What is wrong with this ReportPath?: /Pages/ReportViewer.aspx?/IL_User/Weekly_ConversionAppRate
When I view it from ReportServer it works, but not when I run it in reportviewer in asp.net 2.0
FYI: ReportServerUrl: http://ildevsvr02-v05/reportserver
I get the following error: The path of the item "/Pages/ReportViewer.aspx?/IL_User/Weekly_ConversionAppRate" is not valid. The path must be less than 260 characters long and must start with slash. Other restrictions apply. (rsInvalidItemPath)
thanks
|
|
|
|
|
Difference among data grid ,datagrid,repeater
|
|
|
|
|
how can v use object pooling concept in our application and wat is need of Object pooling in .net
|
|
|
|
|
|
k tanx but can u explain little more abt object pooling
Regards
Raja
|
|
|
|
|
an object pool is a set of initialised objects that are kept ready to use, rather than allocated and destroyed on demand. A client of the pool will request an object from the pool and perform operations on the returned object. When the client has finished with an object, it returns it to the pool, rather than destroying it.
Object pooling can offer a significant performance boost; it is most effective in situations where the cost of initializing a class instance is high, the rate of instantiation of a class is high, and the number of instantiations in use at any one time is low.
Source google.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Would be nice if you can share any example. I am new to this world.
Amit
|
|
|
|
|
please explain me abt Web Farm and Web Garden ?
raja
|
|
|
|
|
when we are working with more then one server like database stored on different server , Bll,Dll are on different server
Mahendra
|
|
|
|
|
How to write code to store a file on a mobile phone from an asp.net page via WAP.Please urgent.......(i had an application which allows users to download contents of it to the users mobile through WAP.After clicking download button how should i make the file to directly store in to the mobile.
|
|
|
|
|
Hi,
I am using webservices to create xml files . I can easily save these on local drive. But while saving it on the Network drive , it gives error.
Is there any solution for this?
Thanks in advance!
|
|
|
|
|
Hi,
Do you have access to store the files on the remote machine? Aslo could you please let us know how you are saving the files on the local disk?
Regards
Mahe
|
|
|
|
|
I am using Webservices to generate and save the Xml. basically made an object of XmlDocument which exposes funtion save. Function has passing parameter as path . So i can give local path as "C:\..." . It even works for localhost as "http:\\localhost\..." but when i change that to "http:\\iP of the comp on network " it thows an error.
I also tried mapping of network drive and then give pathe as any local drive but in vain
Meeta
|
|
|
|