|
Good answer. +5
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi
How can I Limit size of pictures for upload in my web site (VS2010 – C#)?
Thanks very much
|
|
|
|
|
You can find that information in a place we like to call, documentation[^]
"The default size limit is 4096 kilobytes (KB), or 4 megabytes (MB). You can allow larger files to be uploaded by setting the maxRequestLength attribute of the httpRuntime element."
Failure is not an option; it's the default selection.
|
|
|
|
|
suggest used JS, U'll know the file size befor U loadup.
|
|
|
|
|
Do you want to limit the size under a certain value?
|
|
|
|
|
Hi
I export my GrideView from asp.net to excel but the fields which contain Persian character don’t export finely (VS2010 – C#). HOW CAN I DO IT?
My code is :
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition",
string.Format("attachment;filename={0}.xls", "Exported"));
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentType = "application/ms-excel";
using (StringWriter sw = new StringWriter())
{
using (HtmlTextWriter htw = new HtmlTextWriter(sw))
{
// Create a table to contain the grid
Table table = new Table();
foreach (GridViewRow row in GridView1.Rows)
{
table.Rows.Add(row);
}
// render the table into the htmlwriter
table.RenderControl(htw);
// render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString());
HttpContext.Current.Response.End();
}
}
Thanks very much
|
|
|
|
|
Format your code snippets
Failure is not an option; it's the default selection.
|
|
|
|
|
if you want export fine,you used row[m][n],each other cell, you'll format fields to excel.
|
|
|
|
|
A completely useless and uninformative answer
Failure is not an option; it's the default selection.
|
|
|
|
|
You don't export the GridView, you export the DataSource of the GridView.
Assuming you are using a DataTable as the DatSource
StringBuilder sb = new StringBuilder();
List<string> rows = new List<string>();
foreach(DataColumn col in DataSource.Columns)
{
rows.Add(col.ColumnName);
}
sb.AppendLine(string.Join(",", rows.ToArray()));
rows.Clear();
foreach(DataRow row in DataSource.Rows)
{
foreach(object item in row.ItemArray)
{
rows.Add(item.ToString());
}
sb.AppendLine(string.Join(",", rows.ToArray()));
rows.Clear();
}
Response.ContentType = "Application/x-msexcel";
Response.AddHeader("content-disposition", "attachment;filename=export.csv");
Response.Clear();
using(StreamWriter writer = new StreamWriter(Response.OutputStream, Encoding.UTF8))
{
writer.Write(sb.ToString());
}
Response.End();
Failure is not an option; it's the default selection.
|
|
|
|
|
Hi ,
I am getting this error
Exception of type 'System.OutOfMemoryException' was thrown.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +43
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +127
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +142
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +613
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +57
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +54
System.Web.Compilation.CodeDirectoryCompiler.GetCodeDirectoryAssembly(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories, Boolean isDirectoryAllowed) +600
System.Web.Compilation.BuildManager.CompileCodeDirectory(VirtualPath virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet excludedSubdirectories) +128
System.Web.Compilation.BuildManager.CompileCodeDirectories() +197
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +320
[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.]
System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +58
System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +512
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +729
[HttpException (0x80004005): Exception of type 'System.OutOfMemoryException' was thrown.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +8910703
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +85
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +259
I am fetching only 15 record at a time and i have dispose dataset after bind grid,
this error has been occured in my website.
please help me
thanks
|
|
|
|
|
Each time you fetch your 15 records, you have to do some clean-up, or exit the function completely for the garbage collector to free memory in the heap.
So you must of used the new word some where, and your not destroying the object when done, or the 15 records are huge in size, like binding 100,000 records to a drop down box.
|
|
|
|
|
Is the exception being thrown on the dev box or a server?
It would help if you posted some code.
Maybe it's just that (out of memory) if you're in your dev box and have lots of things open (like visual studio) and the dev box has not a lot of resources.
Also, call GC.Collect() and verify if you still get the problem.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Out of memory exceptions are usually down to recursion - are you running a loop to process? Perhaps you're not incrementing a loop counter and it's processing the first record over and over...
C# has already designed away most of the tedium of C++.
|
|
|
|
|
In my asp.net application retrieving xml tag values to a control using recordset but its not working in firefox but working fine in I.E.
|
|
|
|
|
Member 8196580 wrote: retrieving xml tag values
What are tag values?
Their elements or atributes, and I don't think the web browser has anything to do with it, because it's done on the server side. So that means that in firefox, your html is not valid.
|
|
|
|
|
Experts,
I am working on a Email validation. My requirement is i have to check for the email does not contain hyphen(-) repeated continuously for 2 times.
Example:
a-b-c@d.com – valid
a—bc@d.com – not valid since hyphen(-) occurs continuously for 2 times
I have to validation both in code and also using javascript. I have written a method like comparing the charactes and incrementing the local variable. But is there any quick process for this?
Your help would be highly appreciated.
|
|
|
|
|
|
padmanabhan N wrote: But is there any quick process for this?
if string.contains("-")
FileName = FileName.Replace("#", "_")
|
|
|
|
|
Did you even bother to read the question?
1) email address not filename
2) the OP is looking for repeating characters, not every instance
3) the characters are not being replaced
Failure is not an option; it's the default selection.
|
|
|
|
|
I read the question, but I broke the rule of providing a clear comprehensive answer for email address.
The replace was just a quick way to to correct the double hyphen on the server side. Just food for thought.
string.replace("--", "-")
on the JQuery/Javascript side, I would just use regex, I haven't tested the regex for double hyphen, but I should today.
var re_EmailAddress = new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\w+)*\\.\\w+([-.]\\w+)*")
var txt_EmailAddress_Validate = $('[id*="_txt_CreateNewAccount_Email_Field"]').val().trim();
var match_EmailAddress = re_EmailAddress.exec(txt_EmailAddress_Validate);
if (match_EmailAddress == null) {
}
else {
}
I suppose there is a way to step through the email address in Javascript one char at a time, and get the position of the first hyphen, and check for a hyphen after the first occurrence. But I'm not going to experiement with that right now.
|
|
|
|
|
Hi,
As Mark noted, it may be easiest to solve this by using Regular Expressions.
On the server side you should use the Regex class found in the System.Text.RegularExpressions namespace.
A simple pattern to match exactly two repeated hyphens looks like "-{2}" . If you want to match 2 and more consecutive hyphens, the pattern may be modified to "-{2,}" . Then you can use the IsMatch method from the Regex class to test a string (In your case the email) like this:
Regex regex = new Regex("-{2}");
bool isValid = !regex.IsMatch(emailString);
On the client side is even easier. You can use the same pattern with the RegExp JavaScript object.
Then, call its test method. Something like this:
var regex = new RegExp('-{2}');
var isValid = !regex.test(emailString);
var isValid = emailString.search(/-{2}/) == -1;
I hope this is helpful
2A
modified 24-May-12 4:48am.
|
|
|
|
|
Dear All,
I want to develop an Hospital Management System, that will include EMR(Electronic Medical Records)
This will be a Huge Application, But i am Stuck, From Where to Start.
I am Developing in .Net and Ms Sql
So, if any one has already developed something like this. I have already started work on this.
Any Scope documents, Features List, DFD etc
All Help is Appreciated
Thanks in Advance
Santosh Pathak
Business Analyst| Project Manager
www.regaliya.com
|
|
|
|
|
santosh_pathak wrote: Any Scope documents, Features List, DFD etc
You need to make one for yourself.
santosh_pathak wrote: I want to develop an Hospital Management System, that will include EMR(Electronic Medical Records)
Good. Now, your first step should be to find out what all a hospital management system need to have. You need to explore by yourself. Start with limited features you can think of.
santosh_pathak wrote: This will be a Huge Application, But i am Stuck, From Where to Start.
How do you know it will be huge until you know what all it will cover?
Follow these in order:
1. Gather the requirements of the project
2. Design the database for the requirement
3. Design solution architecture for it
4. Define object models and class for the data
5. Plan the UI to capture/show data
6. Implement features step-by-step
Try!
|
|
|
|
|
Thank You Sandeep
Noted !!!
Santosh Pathak
Project Manager | Business Evangelist
www.regaliya.com
|
|
|
|