ASP.NET is a web application framework developed by Microsoft to allow programmers to build dynamic web sites and web applications.

learn more… | top users | synonyms

1
vote
1answer
14 views

Asp.net MVC4, Lamba Sorting

I have the List method that takes sorting parameter to sort result. and the sorting parameter value is same to column name. And this is my code, public ActionResult List(string sorting = "Name", ...
1
vote
1answer
22 views

Making a property virtual to cause EF to load the property?

I am walking through a sample MVC4 ASP.Net tutorial available on PluralSight.com, by Scott Allen. I am in a section #5, Working with Data (part 2), "Listing Reviews". This application has a database ...
-1
votes
0answers
33 views

Checklist for coding MVVM web application [closed]

We are a small team working on a web application using MVVM design pattern using technologies like .NET, Knockout and HTML. I am trying to come up with a code review process and as a first step trying ...
1
vote
1answer
26 views

XmlNodeList to ListItemCollection, a matter of elegance

at this moment I'm reading an XmlNodeList into a ListItemCollection one node at a time using a foreach. foreach (XmlNode node in authCompXml.SelectNodes("//Code")) { CompaniesList.Items.Add(new ...
2
votes
0answers
64 views

Models in .NET: separate settings?

For my models for a certain section I thought it would be better to have a base class model for both "view" and "edit" models, like so: public abstract class Setting { [Required] public int ...
2
votes
1answer
25 views

Is there a method to add multiple properties to HtmlTextWriterStyle?

I am creating new elements for a webpage at run-time and I have code like this: var dynDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("Div") {ID = "dynDiv"}; ...
0
votes
1answer
42 views

ASP.Net caching helper

I'm willing to simplify the use of the ASP.Net cache. I wrote this helper class : public static class CacheHelper { public static T GetCached<T>(string key, Func<T> initializer, ...
1
vote
0answers
42 views

Best practices in implementing service methods

Consider the following architecture: ASP.NET MVC Application having controllers which depend on service classes (MembershipService, EmailService etc.) which in turn depend on data access context ...
2
votes
3answers
109 views

Using Linq to select the first and last values

I want to get just the first and last values in a date range. I have the following code: using (var myEntities = new dataEntities()) { var myValues = (from values in myEntities.PointValues ...
2
votes
2answers
52 views

Building Session-Variables from a sql stored procedure

I have been advised to submit my code here by a fellow Stack contributer as it was suggested the code could be further improved; Calling Code and attempt at building session variables: DataTable ...
-2
votes
0answers
27 views

Is it a good Idea to upload Image after encoding it to base64 to enable fileUpload via Ajax? [closed]

I want to upload different files via Ajax post to my asp WebService. Is it a good idea to convert the file into base64 encoding and send it to Asp and convert it back again to byte array?
1
vote
2answers
37 views

MVC : Does code to save data is session or cache belongs in controller?

I'm a bit confused if saving the information to session code below, belongs in the controller action as shown below or should it be part of my Model? I would add that I have other controller methods ...
1
vote
2answers
70 views

Insert Selected item in listbox using Ado.net and stor proc

I create this class method to Enter Selected Items Form CheckboxList to associated resource I use ADO.net & store Proc to insert data can someone help me to improve it and make to so clean instead ...
1
vote
1answer
65 views

Truncate port number from absolute Uri

We had a requirement to remove the port number from the Request.Url.AbsoluteUr i.e Actual: https://mysitename:443/Home/Index Excepted: https://mysitename/Home/Index The code I used for ...
2
votes
0answers
91 views

Display progress bar to show async. request status using JQuery

Instead of using ProgressBar plugin, I've below script to display the progress bar for async. requests on the page. Could anyone provide any feedback on this esp. if there will be any issues like ...
1
vote
0answers
39 views

Sugestion on a better way to code this EF update?

I have a block of code that pulls the current menu position and compares it to what users selected, if the selection is different the database is updated with the new selection. As I am still new with ...
1
vote
2answers
76 views

MySQL GEAR, C# class for ASP.NET project

I've developed my own class in ASP.NET project to access MySQL and make queries, scalars and read the result from it. I want you to review my class and tell me where did I make a mistake, thanks! ...
2
votes
1answer
65 views

Cropping and combining two images on server

I've coded following two methods to combine images that are HTTP POSTed to the server: // Crops two squares out of two separate images // And then combines them into single image that's returned as ...
4
votes
2answers
210 views

Is there a better way to consume an ASP.NET Web API call in an MVC controller?

In a new project I am creating for my work I am creating a fairly large ASP.NET Web API. The api will be in a separate visual studio solution that also contains all of my business logic and database ...
1
vote
2answers
66 views

Is there a simpler way to write a row from one table to another?

I have the following code: const String sqlSelect = "SELECT * FROM UserPasswords WHERE username='System Administrator';"; const String sqlInsert = "INSERT INTO UserPasswords VALUES ...
3
votes
1answer
168 views

asp.net (vb.net): handling of open database connection and calling shared function from web api

I'm working on an ASP.NET project using VB.NET that uses Dapper and the code as implemented so far runs fine with just me testing. In the example below, Dapper calls a stored proc. But my I am ...
0
votes
1answer
61 views

Asp.Net Custom Server Control: PostBack handling

I wrote a custom server control. The data in it can be manipulated on the client and the changes will be written into the hidden field. The data represents a property of the control and should be ...
1
vote
1answer
50 views

Changing master page's menu

Discovered that the existing menu in a web app I'm working on has an issue in Chrome, where the "Logged in as" section would jump off the menu bar down below. After looking through the code, I'm ...
2
votes
3answers
242 views

Simplify C# Code

Is there a better way to write this in vs2010 C#? public bool IsAccept() { //check the status is accept if (Status == null) return false; return Status.ToLower() == "accept"; } ...
0
votes
1answer
120 views

How can I implement the generic repository pattern and improve the performance for the code below?

I've used EF-DB first approach and have written a simple app to retrieve the data from the database and show it in the view. The code is simple and ok for a beginner like me, but how can I implement ...
0
votes
0answers
14 views

optimize this AntiDos HttpModule

I've written this module ( using a tutorial on the web I can't find now ) to stop unusual requests from clients . it's working as I tested it on local system . 1- but I'm not sure if its logic is ...
1
vote
1answer
111 views

What should I do to improve my first MVC 4 application built with C#

I've started learning .NET with MVC 4 in C# and I built a basic application to display records from a MySQL database. It's incredibly basic, but it's the best I could come up with being a complete ...
1
vote
1answer
53 views

Handle OnClick in Jquery or C#

I am working on a webforms project using c#/aspx/jquery. I'm not sure where to handle my Onclick. Both options (doing it in C# or jquery) seem feasible. Which would be better practice? Here is the ...
0
votes
0answers
43 views

modal window with form

First, Sorry for my English. I'm very new in web development. I want that you make code review of my code. I have profile page where contains two tabs:User Info and Violations. In the User Info tab ...
1
vote
1answer
52 views

Creating a new item or updating an existing item

Something about my code just doesn't seem right. It feels cumbersome and not very logical. Could someone put me out of my misery and let me know that I wrote this bit ok? It's pretty simple, when ...
3
votes
3answers
227 views

How to refactor this property's code?

I have a view model with properties that represent years and months: public IEnumerable<SelectListItem> Years { get { return new SelectList( Enumerable.Range(1900, ...
3
votes
1answer
175 views

Refactor if statements

I am importing an excel document into my project. I then use the following code to verify that columns have data and display the appropriate error message. My code is working but it just doesn't ...
0
votes
1answer
45 views

improve & review NewCustomer page?

just I wan to ask how to improve my code especially contact info block using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using ...
1
vote
0answers
34 views

ASP.NET MVC - Help needed to Improve the code for Drop-Down Box?

I have created the below drop-down to populate a list of cities. All works fine, but I would like to know the better ways of doing this please. Also, please let me know if it is possible to create ...
1
vote
1answer
351 views

Custom Paging in ASP.Net Web Application

I have following code for doing custom paging from an asp.net web application. Points of interest It uses Link Buttons as suggested in ...
1
vote
0answers
24 views

PBKDF2 Authorization first go, is this optimal?

I've discovered that using hashed passwords with salts is much better idea than MD5/SHA256 so I'm not hashing them with PBKDF2. However I'm wondering if this is correct approach to authorize my user. ...
1
vote
1answer
96 views

How to dynamically Generate Sort strings for Data Layer from Controller

I need help refactoring this code to dynamically generate a sort string that I can send to my data layer so that my database does the sorting instead of it happening in memory. I am using MVC4 with ...
0
votes
2answers
364 views

ASP.net proper login - logout classes - control login status

Would you have any suggestions improvements for the below functions classes ? Ok here how do i make a registered member login HttpCookie LoginInfo = new HttpCookie("LoginInfo"); ...
0
votes
1answer
37 views

Looking for recommendations on a cleaner way to set ASP.Net Control values dynamically

I've been given the criteria of dynamically populating values on a web page based on values the user saved. This gist has the basics of the code. What I'm wondering is if anyone can suggest a better ...
0
votes
0answers
61 views

jQuery ui draggable-sortable List, used to Create a Gui Sql Crud-Capble Data-Driven Website application

in this JsFiddle (the link below, it's also my first JsFiddle setup , great tool!), I am trying to implement a new jQuery ui : draggable, droppable and sortable list , so this gui will be the ...
-2
votes
2answers
155 views

compare two date time in dd/mm/yyyy formate [closed]

I have two dates in format of dd/mm/yyyy or dd/MM/yyyy. I want to compare both date but when I am using convert.todatetime(), its not giving me proper solution. There is any one have any idea about ...
1
vote
0answers
351 views

DataTable 'adapter' To Html table generator

this is a project i am working on it generates an html table out of a query result. (the result DataTable of an sql command via SP) this section of the project is the one that will generate the ...
2
votes
2answers
174 views

Reusable user control (ascx) design for multiple web application

My company's web application projects are heavily based on user controls. One common case is like we want to reuse the UI visual elements but note the packaged original logic . I have read some very ...
3
votes
2answers
90 views

Would like feedback and ways to improve my c# ado.net code

I currently have a method in my repository that will run sql and map the reader to objects. protected IEnumerable<T> Query<T, TFactory>(string sql, List<IDbDataParameter> parameters ...
4
votes
6answers
401 views

Strategy for avoiding threadpool starvation while performing cpu bound jobs in a queued fashion

My aim is to avoid using threadpool threads for CPU bound work, thus avoiding a situation where IIS stops responding to new requests. Can you see any problems with the code below? Is this a ...
0
votes
3answers
185 views

Using a Dedicated Class & Constructor to initialize Stored Procedure for SQL Transaction

as i thought it will be sutible as a Quetion for SO... i started to describe the issue of my Problem, though as i completed Editing the post , i could see that it will better fit here, In CR. so to ...
-1
votes
1answer
148 views

my first comprehensive solution : C# “DataDriven Web Appication” Ft. my “Html Markup Generator” needs Professionals Help!

this project is very important for me so i decided to post it here .. with hopes it'll enable me to Draw some Experienced developers attention, as it start to get a little too complex for my skills ...
0
votes
1answer
232 views

refresh tree view after button click

i have used below code for filtering tree view, search function works correctly, but i do not know how to refresh tree view and populate that after clicking the button. private ...
2
votes
2answers
208 views

How to work with List<TreeNode>

Before I have a question about filtering tree view and returning just frst match.( Tree view filtering does not return all the files) So I try to create list and change the code, is it possible ...
1
vote
1answer
86 views

Is My Data Access Leaking Connections?

Folks I have an N-Tiered ASP.Net Web Forms application which uses Enterprise Library 5.0 for data persistence. Recently I have noticed my application has been spitting out the following error ...

1 2 3 4