C# - Optimized This Code And Make It More Dynamic?

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


Similar Messages:

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

Error: Unable To Evaluate Expression Because The Code Is Optimized

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

Unable To Evaluate Expression Because The Code Is Optimized But No Response.redirect?

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

ADO.NET :: Make A Linq Query Dynamic In The Pseduo Code

Sep 9, 2010

is it possible to make a Linq query dynamic in the following pseduo code (to show what I'm trying to do)

[Code]....

where a2 and a3 and a4 are being populated from user controls and only one will apply. So query is done by state, zip or by city, but not by more than one, so the other two would be null. So the operator is really "OR" but I haven't found anything on a "or" or "whereOr" operator.

View 9 Replies

Unable To Evaluate Expression Because Code Is Optimized Or Native Frame Is On Top Of Stack?

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

Web Forms :: Unable To Evaluate Expression Because Code Is Optimized Or Native Frame Is On Top Of Call Stack

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

Crystal Reports :: Exporting Works In HTTP Error - Unable To Evaluate Expression Because The Code Is Optimized

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

Display Dynamic QR Code In Crystal Report In .net Page C# Code-behind

Mar 14, 2011

I'm using CRv9 and want to make use of Google Charts API for generating QR code on fly (in asp .net) and display it in the Crystal Report in a PDF format.I have spent the whole day looking for solution with no luck. The way we output the report is we use .rpt file, feed it with data and use Response.OutputStream to feed to browser. No CrystalReportViewer control hence CSS solution is not an option.

Now, I got as far as added an OLE Object from file with Link, which I would be overwriting every time the new QR code is generated. I apreciate that CR requires it to be a bitmap, so I was planning to download and convert the google's generated PNG file to BMP, that's not an issue. The problem is that Image in the report does not update after I replace the file. Meaning, it displays the original image, which was added as an OLE Object.

If I open this report in CR designer, the image gets refresh/updated and I'd have to save changes to the report to see this new image next time I generate a PDF file.The question is really how to achieve a dynamic image in Crystal Reports 9? Remember, Picture object did not have a Graphic Location property until vXI, so I cannot use that.

Manipulations with DataSets is not an option either as we're not giving report a datasource, instead we just map the fields with FormulaFieldDefinitions.

sample qr code url: https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello%20world&choe=UTF-8

View 3 Replies

Mobiles :: Web Sites Optimized For Browsers

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

An Image From Byte To Optimized Web Page Presentation?

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

Make Dynamic Navigation Bar?

Jun 29, 2010

How I can Make Navigation bar in my site as A>E>D>S>H. I tried more to find an example also I searched more but I couldn't find particular example searched

View 2 Replies

Web Forms :: How To Make A Dynamic Sitemap

Jan 27, 2010

I need to make a sitemap with all the products i have in database.

I can make it easly in aspx web file, but is it better if i make it in Web.sitemap file? Would search engines find it?

And if is better to make it in Web.sitemap, how can i create siteMapNode for each product i have (and i add) in database?

View 12 Replies

How To Make Dynamic Class Names

Jan 25, 2010

I got a design which I basicly use for 100's of websites, and have a virtual folder for masterpages with is copied from a project using build events.Each Masterpage (as this stage), I can rename them or change the names if it helps with this problem, but I need to be able to access the propertys in the masterpage code / dllso I have come up with this

[Code]....

View 5 Replies

Web Forms :: How To Make Dynamic Themes In CSS

Feb 22, 2010

I have new task..

I'm work with asp.net to make website..

how to make dynamic theme in CSS?

View 4 Replies

DataSource Controls :: Select Parts Of Large Tables Optimized?

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

Web Forms :: Make Dynamic Scrolling List?

Jan 16, 2011

how to make Dynamic Scrolling list in asp.net ? i have a text file that contain sentences, and i want to show those sentences in dynamic scrolling list in my webform (like news)

View 1 Replies

Possible To Make Dynamic Link Building Class

Jul 3, 2010

Im new to ASP.NET. Im trying to develop ecommerce web application and i found dynamic link building class and i dont understand how it works.

public class Link
{
// Builds an absolute URL
private static string BuildAbsolute(string relativeUri)
{
// get current uri
Uri uri = HttpContext.Current.Request.Url;
// build absolute path
[code]...

View 3 Replies

Simplify LINQ-To-Entity Query, And Make It Dynamic

Dec 4, 2010

I have this query for getting data through Entity Framework, which works today. Thing is, i want to create the query dynamically, i.e build it up in blocks, but i can't figure out how exactly to do it. I believe if i can somehow save one of the values that i retrieve in the beginning i can do it, but now i retrieve it twice (probably a bit slow as well? Unless the compiler fixes it before quering). Makes sense? Here is the LINQ:

[code]....

I.e based on if various variables have values.

View 1 Replies

.net - Dynamic Data - Make Friendly Column Names?

Jun 17, 2010

I've created a Dynamic Data project with an Entity Framework model. It works nicely. But, right now it shows all my database tables with the db column names - which aren't always the most friendly (e.g. address_line_1). How can I got about giving these more friendly column titles that will display to the end user?

View 2 Replies

Crystal Reports :: Make Dynamic Report Generating Tool?

Jun 10, 2010

I want to mak a Dynamic Report Generator with the facility to create the report structure and change the report information.

whether I can use any crystal report generating tool or have to make my own report generator

View 1 Replies

SQL Reporting :: Make Dynamic Changes To ReportViewer Report Design InteractiveSize Property

Aug 27, 2010

how to dynamically change the Report design InteractiveSize property? I want to use a radiobutton list which has two options (complete list, paginated list) which changes the height of the Report display. I wonder if I need to use the Report Parameters but how do I change and refresh to display the selected option.

View 2 Replies

Forms Data Controls :: Make GridView Header Template Dynamic?

Mar 10, 2011

I am making one pointing web application. There are different Points like 20 Points, 50 Points, 75 Points,etc. These are saved in Database.This Points are belongs to some Vendors. Customer will take the Points from Vendors.want to show the summary in gridview like how many customer use 20 points, how many customer use 75 Points, etc.I want the Gridview Like below

Vendor Name 20 Points 50 Points 75 Points

ABC 5 7 8
XYZ 10 16 5

First Question, How can I represent the data in the above way?Second Question, If I add one more point like 100 Points, then how the one more column will come like below:

Vendor Name 20 Points 50 Points 75 Points 100 Points

ABC 5 7 8
4
XYZ 10 16 5
16

View 5 Replies

Looking For Dynamic Code From The Database?

Jul 15, 2010

We currently allow users to store HTML in the database. Would like to allow them to add scriptlets to their HTML email templates that would be executed at run time. Example:

[Code]....

What I want to have happen is to have the scriptlet execute before being rendered to the output stream.I found an article from Rick Strahl that is about 8 years old:

http://www.west-wind.com/presentations/dynamicCode/DynamicCode.htm. It looks like the code at the very bottom is exactly what I want, but when I tried it in my .Net 4 app, it didn't work. I get the error:

2 Errors:Line: 0 - Metadata file 'RemoteLoader.dll' could not be found

Line: 0 - Metadata file 'wwScripting.dll' could not be found

I presume this is from the Generated source code. Not sure how I tell the Generated source code where those 2 DLLs are.

Is there a different/better way of doing this these days?

View 6 Replies

Forms Data Controls :: Make Specific Cells In A Dynamic Gridview Clickable And Capture The Cell Info Before Redirecting

Aug 3, 2010

I generate dynamic grids based on a count value returned from some DB tables. the code for it goes like this : I give and Id to each grid that is generated.

if (myDataList1.Count >= 1)
{
for (int i = 0; i < myDataList1.Count; i++)
{
//retrieving the exact i count from pageload
ViewState.Add("newCount", i);
//creating the dynamic grid with its corresponding gridview properties.
grvDynamic = new GridView();
grvDynamic.ID = "GridView" + (i+3);
grvDynamic.AutoGenerateColumns = false;
grvDynamic.RowCreated += GridViewRowCreated;
grvDynamic.RowDataBound += grvDynamic_RowDataBound;
//adding bound field columns to retrieve data from stored proc
BoundField metric = new BoundField();
metric.HeaderText = "Goal ";
metric.DataField = "metric";
grvDynamic.Columns.Add(metric);
BoundField mtd = new BoundField();
mtd.HeaderText = "MTD";
mtd.DataField = "value_MTD";
grvDynamic.Columns.Add(mtd);
BoundField goal = new BoundField();
goal.HeaderText = "Tier Level Achieved";
goal.DataField = "value_goal";
goal.HeaderStyle.Width = Unit.Percentage(10);
grvDynamic.Columns.Add(goal);
BoundField you1 = new BoundField();
you1.HeaderText = "Month End";
you1.DataField = "firstLevel_you";
grvDynamic.Columns.Add(you1);
BoundField you2 = new BoundField();
you2.HeaderText = "Month End";
you2.DataField = "secondLevel_you";
grvDynamic.Columns.Add(you2);
ButtonField singleClick = new ButtonField();
singleClick.CommandName = "clickHyperlink";
singleClick.Visible = false;
grvDynamic.Columns.Add(singleClick);
BoundField metricId = new BoundField();
metricId.HeaderText = "Metric Id";
metricId.DataField = "metricID";
metricId.Visible = true;
grvDynamic.Columns.Add(metricId);
//binding the gridview to data.
grvDynamic.DataSource = data;
grvDynamic.DataBind();
grvDynamic.Columns[5].Visible = false;
}
}

protected void grvDynamic_RowDataBound(object sender, GridViewRowEventArgs e)
{
//this basically gets the metric Id's of rows with the ishyperlink flag set to 'Y'. I need to make these particular cells clickable var isClickable = (from md in myDataList3 where md.IsHyperLinkFlag == 'Y' &&

md.value_MTD != null select md.metricID).ToList();
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Get reference to button field in the gridview.
LinkButton _singleClickButton = (LinkButton)e.Row.Cells[5].Controls[0];

if (isClickable.Contains(Convert.ToInt32(e.Row.Cells[6].Text)))
{
e.Row.Cells[1].Style["cursor"] = "hand";
e.Row.Cells[1].Style["color"] = "blue";
e.Row.Cells[1].Style["textdecoration"] = "Underline";
e.Row.Cells[1].Attributes.Add("onClick", "window.location ='../HeaderPages/page2.aspx' ");
}
}
}

This code works perfectly fine , depending on the ishyperlink flag in the database...specific cells in the grid are made clickable and then redirected to page2.aspx My Issue: I need to capture which specific cell in which specific grid the user has clicked. store some information in sessions based on the cell clicked and use that information in page2.aspx.

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved