|
ya i checked if i give data formatting expression{0:N} Then first value..,first number only i am getting...,
If i remove that format exp then i am getting correct value...,
Magi
|
|
|
|
|
Hi,
Format does not cause error like this. Please check the variables' value after statement like
Dim GTotal As Decimal = Val(MainGRD.Cells(3).Text)
Dim BonusAmt As Decimal = Val(MainGRD.Cells(5).Text)
and check your stored procedure "BonusAdd" and its parameter type and width.
DAsh04
|
|
|
|
|
Hi all,
I would like to know how to view data of a database through the Data Grid View.
Glad if you can give me good referrences and links to tutorials regarding this .
Thank you.
RangaSL
|
|
|
|
|
|
|
Hello all,
i am not getting this. i have made EnableViewState = false to my one of the TextBox & page level also. Still it is showing the values in textbox after postback.
why this is happening
anybody anysounds?
regards
GV Ramana
|
|
|
|
|
Find out from the page source whether the view state hidden field is present or not. If no, and you still get the textbox values, ,it maybe the work of some toolbar in your browser.
SG
|
|
|
|
|
Yes i think it will be there ..
Will you discuss what you want to do ?
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... "
|
|
|
|
|
Description: Failed to execute request because the App-Domain could not be
created. Error 0x80070005 Access is denied.Event ID: 1088
Tried to give asp premission and restart iis but never works. ANy help???
|
|
|
|
|
go to IIS - right click on Virtual Directory -> Properties -> goto Directory Tab -> Create new Appdomain by clicking on Create button over there. if already created, remove it & re create.
hope it will works
regards
GV Ramana
|
|
|
|
|
Hi All,
I have another requirement.
I need the code for uploading files into the database.
I tried using the FileUpload control in ASP.NET 2.0, and got the code(to be put in the button click event code) to upload the files in my own system in some other location.
However, my requirement is that i should be able to upload the file into a remote system or the SQL database.
Please give me the code for this....
Thank You.
|
|
|
|
|
i tried the following code for upload into mu own system but i don know how to go about and upload in the remote server.Please Help.
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
try
{
//The following line of code specifies the path
FileUpload1.SaveAs("D:\\Uploads\\" +
Label1.Text = "The file has been successfully uploaded in to: " +
"D:\\Uploads\\" + FileUpload1.FileName;
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
else
{
Label1.Text = "Oops! You forgot to specify the file! Browse for the file above.";
}
}
|
|
|
|
|
i am trying to implement windows authentication on one of my websites on my IIS but when ever i try to browse to the website a messagebox pops up asking me for my user name and password. but i thought that the authentication would be done in the background automatically without me being prompt to enter my username and password.
What am i doing wrong?
kenny edmond
|
|
|
|
|
what u r exactly trying to do?
u want to give permissions to all the local users?
regards
GV Ramana
|
|
|
|
|
yea thats what i want to do well i want to authenticate that only on persons on my network can log in
|
|
|
|
|
Greeting fellow geeks & geekettes,
I'm running into a difficult problem that I'm finding very hard to troubleshoot, and I hope some people here have had the same issue and can help me resolve it.
I have a couple of websites on our server that use GDI+ to generate some graphics on the fly. The idea is to generate menu items with a specific font.
All it does is create a bitmap, read a background image file and copy over, then loads a local font file using a PrivateFontCollection and write the text onto it. The bitmap is then outputted straight onto the response stream. Pretty straight forward.
Now the problem is that server runs fine for a while, then after a while (few hours, a day at most), the server stops responding. Now the clue is that it only stops responding on those pages that use those generated labels, other pages seem ok.
An IIS restart solves the problem for another few hours, or so.
I would think it's because GDI+ resources are being wasted/leaked somehow.. yeah?
I've tried making the code as tidy as possible, closing/disposing of resources & streams but it's not helping (I actually think it lasts longer if I don't manually clean up but that's just a crazy thought). I've even tried caching the resulting bitmaps to avoid recreating all the GDI+ objects every time.
I have also the impression that it's the font loading/drawing part that's causing the problem, as similar code works fine on another project that doesn't actually write using fonts (just generate thumbnails).
Some pages can have up to 25 generated labels on them, which means 25 requests at a time on the server to generate these. Maybe too many simultaneous access to resources?
Finally, the server is a Windows 2000 Server with IIS 5. My development machine is a Windows 2003 and it doesn't seem to have that problem. However I suspect this is not a valid assertion that Windows 2003 works better as I'm the only user doing requests to the development machine and that is not reflecting the load put on the live server.
Anyway, basically, I'm a bit lost with this, and not being able to reproduce on the development machine doesn't help either.
Any suggestion or idea to test this would be greatly appreciated!
Cheers,
Ben
|
|
|
|
|
Ben[dog] wrote: I would think it's because GDI+ resources are being wasted/leaked somehow.. yeah?
I'd say so
Ben[dog] wrote: and not being able to reproduce on the development machine doesn't help either.
That never bodes well.
You should post some code, if you want us to comment on it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi Christian,
Thanks for trying to help me out..
Christian Graus wrote: Ben[dog] wrote:
I would think it's because GDI+ resources are being wasted/leaked somehow.. yeah?
I'd say so
Do you know or can you suggest any way to test for this?
Christian Graus wrote: You should post some code, if you want us to comment on it.
Didn't want to scare everybody right away with all the code.
Here's the generateLabel.aspx.cs essential:
public class generateLabel : System.Web.UI.Page
{
private ImageFormat Format;
private Color TextColor;
private Color TextColorOver;
private bool Over;
private string Text;
private string Background;
private void Page_Load(object sender, System.EventArgs e)
{
TextColorOver = Color.FromArgb(255,255,255);
TextColor = Color.FromArgb(200,200,200);
if (Request["Over"]!=null)
Over = true;
else
Over = false;
if (Request["Format"]!=null)
{
switch (Request["Format"].ToLower())
{
case "png":
ContentType = "image/png";
Format = ImageFormat.Png;
break;
case "gif":
ContentType = "image/gif";
Format = ImageFormat.Gif;
break;
case "jpg":
case "jpeg":
ContentType = "image/jpeg";
Format = ImageFormat.Jpeg;
break;
}
}
else
{
ContentType = "image/png";
Format = ImageFormat.Png;
}
if (Request["Text"]!=null)
Text = Request["Text"];
else
Text = "Sample";
if (Request["Background"]!=null)
{
switch (Request["Background"])
{
case "On":
Background = "images/RootMenuBackgroundOn.png";
break;
}
}
else
Background = "images/RootMenuItemBackground.png";
if (Cache[CacheKey]!=null)
generateFromCacheKey();
else
generate();
}
private string key;
private string CacheKey
{
get
{
if (key==null)
{
key = String.Format("Label_{0}{1}{2}",Text,Format.ToString(),Over);
}
return key;
}
}
private void generateFromCacheKey()
{
Bitmap b = (Bitmap) Cache[CacheKey];
MemoryStream io = new MemoryStream();
b.Save(io, Format);
Response.BinaryWrite(io.ToArray());
io.Close();
}
private void generate()
{
try
{
PrivateFontCollection pfc=new PrivateFontCollection();
pfc.AddFontFile(Server.MapPath("LTe50342.ttf"));
FontFamily family= new FontFamily("Avenir LT 45 Book",pfc);
Font myFont=new Font(family,14,FontStyle.Bold, GraphicsUnit.Pixel);
Bitmap tmpBitmap = new Bitmap(100,100,PixelFormat.Format32bppArgb);
Graphics objGraphics = Graphics.FromImage(tmpBitmap);
SizeF textSize=objGraphics.MeasureString(Text,myFont);
textSize.Width+=5;
objGraphics.Dispose();
tmpBitmap.Dispose();
System.Drawing.Image imgBackground = System.Drawing.Image.FromFile(Server.MapPath(Background));
tmpBitmap = new Bitmap((int)textSize.Width,imgBackground.Height);
objGraphics = Graphics.FromImage(tmpBitmap);
Brush b = new TextureBrush(imgBackground,WrapMode.Tile);
objGraphics.FillRectangle(b,0,0,(int)textSize.Width,imgBackground.Height);
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
objGraphics.TextContrast = 12;
objGraphics.DrawString(Text, myFont, new SolidBrush(Over?TextColorOver:TextColor),0,(imgBackground.Height-textSize.Height)/2);
MemoryStream io = new MemoryStream();
tmpBitmap.Save(io, Format);
Response.BinaryWrite( io.GetBuffer() );
io.Close();
b.Dispose();
pfc.Dispose();
imgBackground.Dispose();
}
catch (Exception ex)
{
Utility.WriteLog(ex.Message);
}
}
Thanks, much appreciated help,
Cheers
Ben
|
|
|
|
|
I see a Bitmap object and a Graphics object that you never dispose.
---
single minded; short sighted; long gone;
|
|
|
|
|
Ah, cool. Thanks for that.
Well noted for the Graphics object.
The bitmap shouldn't be disposed though, I cut out one too many line while cleaning up before posting it, the bitmap is also saved in the cache.
So if the code would be that then:
b.Dispose();
pfc.Dispose();
imgBackground.Dispose();
objGraphics.Dispose();
Cache[CacheKey] = tmpBitmap;
Would that seem correct then?
Ben
|
|
|
|
|
Yes, that would take care of those.
---
single minded; short sighted; long gone;
|
|
|
|
|
Ben[dog] wrote: Bitmap b = (Bitmap) Cache[CacheKey];
This is not a leak, as it's in your cache, you don't want to dispose of it.
The easy way to write code that makes clear that yo dispose of resources is a using block
using (BItmap bm = Bitmap.FromFile(path))
{
// do stuff with bm here
} // bm.Dispose is automatically called here.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: The easy way to write code that makes clear that yo dispose of resources is a using block
I agree this is often a neat way to do it, though a bit tiresome with GDI+ as there's so many objects created you need to wrap too many using() statements within another, making it a bit hard to move code around or re-arrange things...
But if the individual Dispose() are explicitely called, that shouldn't really make a difference, should it?
Ben
|
|
|
|
|
No, it simply gives you a way to see easily that they are going to be called. I didn't track through all your code, but Guffa said he found two items that were not.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Guffa said he found two items that were not.
Yes, I replied to him, actually one one of them was not disposed, the other is kept in the cache so shouldn't be disposed.
Anyway, thanks for your help, I appreaciate it.
I will do more testing with that last object disposed and see what happens.
Cheers
Ben
|
|
|
|