C# - Make Code More Optimized
Aug 3, 2010
how can i optimized this code? i dont like to have case statement, is there a way i can improve this code?
protected void ddlFilterResultBy_SelectedIndexChanged(object sender, EventArgs e)
{tring selVal = ddlFilterResultBy.SelectedValue.ToString().ToLower();
itch (selVal)
{
case "date":
[code]...
View 6 Replies
Similar Messages:
Sep 21, 2010
is there a way i can optimized this code and make this extensions on web.config settings so i can read from there and in future if i need to add or remove i should be able to do easily?
if (fileExt.ToLower() == ".rtf" ||
fileExt.ToLower() == ".xls" ||
fileExt.ToLower() == ".doc" ||
fileExt.ToLower() == ".png" ||
View 5 Replies
Sep 19, 2010
The code was executing fine but now an exception is generated: "exc = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"
[code].....
View 16 Replies
Dec 8, 2010
I have a class...see code below
[Code]....
and I am calling the class using this syntax....
DataExporter.ExportToXLS(gvtemp,
string.Format("{0}.xls",
DateTime.Now.ToString("ddhhmmss")));
however, i am getting the exception, unable to evaluate expression because the code is optimized and usually, you fix it by adding a false to your response.redirect.
View 2 Replies
Feb 16, 2010
I understand that if you put a Response.Redirect inside a try-catch that you're going to get this error unless you specify the 2nd param of the redirect as false.But even looking at this article (PRB: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer) I still don't understand why I have to set this to false for this particular line of code...we've always had true for that param until I wrapped that in a try-catc
View 1 Replies
May 7, 2015
I want to export the data to pdf in which table has 150 columns.
When i save the file in directory , the file is opening. whereas when open it directly some box type is displaying.
And also am getting exception in Response.End() method which is given below
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
View 1 Replies
Feb 9, 2010
I am using asp.net 2.0 with c#.
" myReportDocument.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, rptName);"
As soon as compiler execute this statement i get error
" [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} "
What will be the possible reasons for the error.
Although it throws execption but it will allow to convert report when i deployed my site using http but when i deployed my site using https then it will shows error .
View 1 Replies
May 15, 2010
At my current place of employment, a university, we are going to take a stab at making a mobile browser-oriented section of our web site. I was wondering if anyone could direct me to some good resources that they know of for such a thing. Primarily, names of books would be nice, but any kind of resource at this point would be extremely helpful. We are approaching this as more of an HTML project at the moment, so the resources don't need to be Asp.Net based, but such things would be great too.
View 4 Replies
May 7, 2010
I get the data of the stored image on database as byte[] array;then I convert it to System.Drawing.Image like the code shown below;
public System.Drawing.Image CreateImage(byte[] bytes)
{
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(bytes);
[code]...
View 1 Replies
May 4, 2010
If I have a huge Order-table and I want to display records from it using paging, what is the best way to select the records from the database?
If I first do like this:
[Code]....
..and then select the records I want based on RowNum it seems like I select ALL records in the first query anyway. I guess I want to do something like SELECT TOP @PageSize FROM Orders...
View 5 Replies
May 11, 2010
This works and returns false ===> (username: <%= this._securityAccesspageBase.DirectReportAccesses.Count > 0 ? false :true%> )
This works doesnt work I was expecting false for the visible property:
[code]....
View 4 Replies
Mar 25, 2010
As the title says, I wan't to run some code when the application starts. I have a vague idea that there is probably an event in the application life cycle but I am a bit unsure and could do with pointing in the right direction. So how do I make code run when the application starts?
View 5 Replies
Aug 17, 2010
I have a textbox (txtbox1) which has some value in it. I want to empty the value of textbox. Is that possible in code behind?
View 2 Replies
Sep 3, 2010
I need to create a code that reads the QueryString and set a value on the Session and on the end of the page I need to clear the Session.
How can I make a code like this to run on all .aspx pages?
View 6 Replies
Jan 28, 2010
you must have seen widgets like code which people place inside their HTML and it starts showing a small widget in there, how we can we do it in ASP.net, for example if i want to show some specific data of my site to anywhere some specific code is placed, how can i generate that embeddable code that can start showing my specific block of data to anywhere from any site?
View 2 Replies
Sep 23, 2010
Recently, I have read an excellent tutorial from asp.net, MVC music store.
I have discover that we can access to variable in strongly typed views like this:
[Code]....
It is very powerful!
Can we do the same with Web Form in aspx pages?
I ask this question because I think that ASP controls for data are very strict like gridview; in fact my real problem is that I want to make a loop in my apsx code and I think that I can't in Web form...
View 3 Replies
Aug 26, 2010
I have an asp.net mvc project, its build just from views, controllers, models, and other files. I have any codebehind file in my views. Does it makes sense to create them for using sometime? Is it some situation when they giving more abilities and advantage for developer?
View 3 Replies
Sep 2, 2010
I have a simple table
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
and a link
<a href=#>Click me</a>
Is it possible to make the whole block of html code disappear all in once after clicking the link in c#? I was thinking about a placeholder but i'm not sure
View 4 Replies
Feb 9, 2010
I was looking for a chat program, and I found it here in Code Project,Build a Web based Chat using ASP.NET Ajax (http://www.codeproject.com/KB/ajax/aspnetchat.aspx)The code is working perfectly,except 2 issues,can anybody tell me how can I overcome these issues?1-how can I get for example the last 2 hours chat from the database, when a new user enters to the chat room? I tried the getlastmessage stored procedure, but because of the refresh, it keeps showing the messages over and over. any solutions?2-In firefox after I hit the enter on keyboard I see two messages instead of one. sometimes it happens in IE too.
View 1 Replies
Mar 29, 2010
I can't seem to make the RCE work with the following code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> [code]....
View 7 Replies
May 10, 2010
I have two classes (say someclass.cs and someclass.generatedcode.cs). How do I make the someclass.generatedcode.cs inside of someclass.cs (something like a code behind) in visual studio?
View 12 Replies
Nov 19, 2010
Still new. What can I add to my site to get picked up by serch engines without paying for services? Right now if I do a search My site does not appear.
View 8 Replies
Oct 21, 2010
I am using some code I found that generates a random password. I am in the habit of putting code in a seperate file. The code was written in the same file and I'm trying to move it to a seperate file and get the following message. Also, below, I posted
the original code (code on same page as aspx) and what I did (code in seperate file).what adjustment needs to be made to make the seperate code file work?
Compiler Error Message: BC31143: Method 'Public Function GeneratePassword(length As Integer, numberOfNonAlphanumericCharacters As Integer) As String' does not have a ignature compatible with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.
Source Error:
[Code]....
ORIGINAL CODE (with code on same page)
[Code]....
MY CODE BEHIND
[Code]....
[Code]....
View 2 Replies
Jan 5, 2011
I am wondering are there any standard mechanisms available to protect the asp.net asp code in the client browser ? I found some references to windows script encoders. Question is,are these script encoders encodes both aspx and code behind source ? If aspx is encoded with the windows script encoders then how client browsers can decode it? Are they aware of the encoding algorithms ?Or can we control the client browsers ( IE, Firefox, Chrome etc) to disable the view source option in the Tasks Menu when web site a loaded in them?
View 6 Replies
Nov 4, 2010
I just come across this W3C validation errors: I have a LinkButton1 on my .aspx file, and in my c# code I want to disable this LinkButton1 in certiain circumstance, hence i was using this code:
[Code]....
View 7 Replies