ASP.NET is a web application framework developed by Microsoft to allow programmers to build dynamic web sites and web applications.
0
votes
1answer
19 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
35 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
14 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
28 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
50 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
48 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
37 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
32 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
55 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
50 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
143 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
64 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
92 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
36 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
38 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
239 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
94 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
13 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
99 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
47 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
36 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
222 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
156 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
32 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
322 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
23 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
89 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
283 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
39 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
121 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
317 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
152 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
86 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
353 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
165 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 ...
0
votes
1answer
132 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
169 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
179 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
84 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
vote
3answers
97 views
Can someone improve this code?
public bool CheckPlace(string State, string City)
{
TestDataContext data = new TestDataContext();
bool IsKochi = new bool();
if (!string.IsNullOrEmpty(State) && ...
2
votes
3answers
119 views
Can someone improve this code? ( I need to eliminate the for loop)
public bool CheckMobileSim(List<Mobile_Range> numberRange, string MobileNumber)
{
bool SimType = new bool();
string NineDigits = MobileNumber.Substring(0, 9).ToString();
long Number ...
2
votes
2answers
107 views
is this code optimized?
hi i have a gridview with CheckBox inside it,and when user select a row and click
on button Message send for spcefic user.
are below code optimized?
protected void ...
2
votes
1answer
65 views
ASP.NET controls positioning
I haven't studied a lot about positioning of controls in ASP.NET using .Net framework 3.5 but still I know following control positioning technique isn't the best one, just to mention its a user ...
2
votes
1answer
66 views
Simple retrieving sessionId rows from indexed SQL column is slow
I have to select all the rows from a database table containing a defined (long)sessionId where the sessionId row is indexed.
But it is slow, and since the code to access it is really simple, I'm ...
4
votes
2answers
120 views
Optimization code for checking if a list contains any element ID of another list
I have the following code:
var sessionsWithError = SessionsFilteredByDate
.Where(i => i.TrackerId > 0 && i.StatusId == 0)
.Select(i => i.SessionId);
var ...
1
vote
0answers
176 views
AJAX MaskedEditValidator isValidEmpty property manipulation
thanks for visiting ,
this is my initial question that lead me to modify the behavior of
AJAX MaskedEditValidator - isValidEmpty attribute.
when you try to cancel the interaction with a form , ...
3
votes
1answer
407 views
ASP.NET Web API HTTP GET with optional parameters
Writing my first ASP.NET Web API web service. Still learing the power of Linq as well. I feel like there is a more ideomatic way of doing this:
public class StylesController : ApiController
{
...