FAQ Database Discussion Community


IDENTITY_INSERT is set to OFF in MVC application

sql,asp.net,asp.net-mvc
I am trying to create a new employee in MVC 5. I used CRUD to generate views and models. I edited a few lines of code and I get this error: Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF. Where I got...

IIS 6 Allow anonymous access by default

asp.net,iis,website,iis-6
I have automated builds the will create IIS websites for me using FinalBuilder scripts. The problem is that in FinalBuilder there is no option to set 'allow anonymous access' to true on creation of the website, so I am forced to go into IIS manager and change this manually. In...

Azure Mobile Services: migrate to non-Azure Windows Server

asp.net,azure,azure-mobile-services
I am planning to use Windows Azure Mobile Services for a new project. As far as I am concerned, Mobile Services are closely tied to Windows Azure. So far, I'm pretty happy with Windows Azure. What if, in the future, I decide to port the functionality to a non-Azure Windows...

Can I use javascript to detect events of asp.net?

javascript,c#,jquery,asp.net,gridview
I am now trying to use gridview to create a web application for users to delete some rows from database. However, whenever I refresh the whole page, strange things happen as selectedIndexChanged was called. Is there any way that I can avoid this method being called whenever I refresh the...

Cant delete in database because of constraints

c#,sql,asp.net,oracle
I am making an asp.net project and I am trying to delete a row in my database but that table got constraints. I am using this method to delete it.How can I rewrite it so that all constraints are disabled or something in order that i can properly delete a...

asp.net background in 3 pieces to be stationary

html,css,asp.net
I am developing asp.net webforms with a background that is made up of 3 images; top, left and right. The 3 pieces are cropped from a full image to accomodate for content body of 770px width in the middle. At present, these 3 images moves with the body content as...

Passing complex array from Controller to View ASP.NET MVC

c#,asp.net,asp.net-mvc,asp.net-web-api
I have a model in my ASP.NET MVC application: public class SearchArrayModel { public long ID { get; set; } public string Name { get; set; } public struct AttribStruct { public string AttribName { get; set; } public string[] AttribValues { get; set; } } public AttribStruct[] AttribStructTable {...

Outlook 2013 Cannot create ActiveX component from ASP.NET Application

asp.net,vb.net,outlook,office-interop
I am trying to send email in VB.Net using outlook 2013. I tested as localhost in debug mode and everything is fine. I can send and read Outlook emails in vb.net. However, when I publish the web application and click the send button I get the following exception: System.Exception: Cannot...

IIS Express 8 - Max allowed length

c#,asp.net,iis,visual-studio-2013,iis-express
In case the below is too long, my question is whether IIS Express 8 in Visual Studio 2013 obeys the maxAllowedContentLength attribute or if it has some overriding value that prevents large requests When debugging some webapi calls against Visual Studio 2013, I'm receiving this error: Maximum request length exceeded....

Unable to find the auto created Database

c#,asp.net,asp.net-mvc,entity-framework
I have created simple ASP.NET MVC4 application using EntityFramework Code first approach. The entity class is as below: public class Album { [Key] public int AblumId { get; set; } public decimal Price { get; set; } public string Title { get; set; } } public class MusicContext : DbContext...

Creating a viewmodel on an existing project

c#,asp.net,asp.net-mvc
I am trying to add a viewmodel to a project because I want my view to use two separate models. I've looked at different tutorials trying to learn how to do this but I am having some trouble. Before, the view was strongly binded(typed?) to the Person model, but now...

Catch concurrency exception in EF6 to change message to be more user friendly

c#,asp.net,.net,entity-framework,entity-framework-6
I am using EF6.1 and i would like to change the message to a more system specific message when the below exception is thrown. Store update, insert, or delete statement affected an unexpected number of rows (0) Now, my problem is i cannot seem to catch the exception? I have...

How to change the colour and style of MajorGrid of AxisY in ASP.net chart

c#,asp.net,charts
I made a chart in asp.net and I want to change the color of the MajorGrid to light grey and style to dash. Any suggestions?

WCF service architecture query

asp.net,architecture,wcfserviceclient
I have an application that consists of a web application, and mutliple windows services, only one windows service is installed depending on what version of the backend sofware is used. Currently, Data is saved by the web app in a database, then the relevant service is installed and this picks...

Event on dynamically created checkbox asp.net

c#,jquery,asp.net,table,checkbox
I started to programming with asp.net, I have a table with some checkboxses. The problem is, I can't create static tables, because this action is linked with some parameters. Anyway.. When I click on the First checkbox I want to invert the other checkboxes in this table. How can i...

LinkButton with ID causes no postback, it does without

c#,asp.net
Problem: When I click my linkbutton the form gets submitted, but it doesn't execute the postback function. It also doesn't execute the click function. These two don't get hit at all. Workaround Remove the ID from the linkbutton. In this case the click function get executed. The button is dynamically...

Can I reset the validation for a Required Field Validator in a Javascript function?

javascript,c#,jquery,asp.net
-I have an aspx page that has several required field validators. -After the user clicks on the save button and the page fails the validation you can no longer do anything on the page except fill in the fields. -Three of the fields are disabled and are filled by clicking...

Setting up routing when RemoteAttribute specifies AdditionalFields

c#,asp.net,asp.net-mvc,asp.net-mvc-4
How to configure actions if I specify AdditionalFields for validation via RemoteAttribute to handle possible optional additional fields? Currently I try to have actions for possible combinations of optional fields and it does not work as show below. I have a form that is bound to a model and one...

Difference between application and module pipelines in Nancy?

c#,asp.net,nancy
I have seen in the documentation of Nancy, sometimes these two are referred distinctively. And also is there a difference in the Before/After hooks of these two pipelines?...

onSuccess and onFailure doesn't get fired

javascript,c#,asp.net,webmethod,pagemethods
I have used onSuccess and onFailure in my PageMethod call. However neither of them gets called and the WebMethod doesn't get fired either. alert("1"); PageMethods.LoginUser(onSuccess, onFailure, email, pass); alert("2"); function onSuccess(val) { } function onFailure() { } [WebMethod(EnableSession = true)] public static int LoginUser(string email, string pass) { //Doesn't get...

Getting 302 response headers from Ajax.BeginForm?

c#,jquery,asp.net,ajax,asp.net-mvc
I have a MVC action that can either return a RedirectToAction (302) or a partial view. I'm using Ajax.BeginForm and an OnSuccess handler to capture the response. My problem is, whenever a redirect response is issued, it seems something (not sure if it's a native AJAX behavior or not) is...

How IE setting affect authorization

asp.net,iis
I have a Webform app written in asp.net 4.5 and trying to understand how IE plays a role for authentication. So far my search has not provided a solid answer I know webconfig setting override iis setting. But assume we set the authorization mode to anonymous in both of iis...

Problems With FOR XML AUTO

sql,asp.net,sql-server,subquery,sqlxml
i have the following Query: SELECT QuestionID_PK , QuestionTitle , ( SELECT dbo.Tags.TagID_PK , dbo.Tags.TagTitle , dbo.Tags.TagTitle_EN FROM dbo.Question_Tag_Rel INNER JOIN dbo.Questions ON dbo.Question_Tag_Rel.QuestionID_FK = dbo.Questions.QuestionID_PK INNER JOIN dbo.Tags ON dbo.Question_Tag_Rel.TagID_FK = dbo.Tags.TagID_PK AND dbo.Questions.QuestionID_PK = '2116' FOR XML PATH('') , TYPE , ELEMENTS ) AS Tags FROM Questions WHERE...

How can I read the logExtFileFlags from the “Default” site?

c#,asp.net,logging,iis-7
I am attempting to read IIS 7 configuration data remotely, specifically the logExtFileFlags from the Default site. When I look at the applicationHost.config on the remote server, I see the information in question: <system.applicationHost> <sites> <site name="Default" id="1" serverAutoStart="true"> <logFile logExtFileFlags="Date, Time, ClientIP, UserName, SeverIP, Method, UriStem, URIQuery, HttpStatus, TimeTaken,...

How to format label in ASP.net chart control

c#,asp.net,asp.net-mvc,c#-4.0,reporting-services
I have created a column chart in asp.net. I am showing the date on x-axis. At the moment the date is shown as dd/mm/yyyy. All I need is to show the date as dd-mm-yy and ideally Weekday, dd-mm-yy e.g. Monday, 12-05-15. <asp:Chart ID="Chart1" runat="server" Height="400px" Width="900px" BorderWidth = "1"> <Series>...

Sending LIst via ajax to complex model

javascript,c#,asp.net,ajax
I know I've done this before but I can't seem to get this to work. I have the following JavaScript; $("#btnTestVouchers").click(function () { var postData = { "workplaceGiverId": $(".wpgDropdownList").val(), "fromMemberId": $(".wpgFromMemberDropdownList").val(), "toMemberId": $(".wpgToMemberDropdownList").val(), "voucherExpiryDate": $("#expiryDatePicker").val(), "recipients": JSON.stringify("[{'firstname':'a','lastname':'b','email':'c','voucheramount':'d'}]") }; console.log(postData); $.ajax({ type: "POST", url:...

fancybox href =“imageURL” using populated image1 in datalist1

javascript,c#,jquery,html,asp.net
i have fancybox in my gallery that are populated in my web page using datalist1. my fancybox image viewer is working when I set the imageUrl and href value like this <a class="fancybox" rel="group" href="~/Image/Slides/Image1.jpg"> <asp:Image ID="Image1" ImageUrl="~/Image/Slides/Image1.jpg" runat="server" Width="50%"/></a> &nbsp;&nbsp; now the problem is, i'm not setting the ImageUrl...

How to Convert a Time to local Time in Different TimeZone

c#,asp.net,asp.net-mvc,timezone,timezoneoffset
Currently i am working on a chat project from where many users can communicate through each other sitting across the globe. ie: Different TimeZone. eg. 1st in India 2nd in America 3rd in Russia 4th in Australia I am saving my message sent time into database as DateTime.Now.ToUniversalTime() Issue i...

CommandName = Insert in EditTemplate of ASP.NET ListView throws “Insert can only be called on an insert item”

c#,asp.net,listview
I am supporting a web application. In that, there are two tables - TaxCode and TaxRate. TaxCode has 1 to many relationship with TaxRate. The UI has a ListView with LayoutTemplate, ItemTemplate and EditTemplate to show TaxCode. When the users selects a tax code in EditTemplate it shows a CutomGridView...

how to generate continous id from C# [closed]

c#,asp.net
i have a text box for task id . its read only and it should be entered like this T-001 and it will count from database.im getting for upto T-001 to T-009. how to make upto T-100.im hardcoded with T-00 + i. private void getTask_ID() { int i = 0;...

.NET wep api won't accept %2E or . in api request uri

c#,jquery,asp.net,ajax,json
We're trying to create our first web api using the .net framework. To try this we've used this demo project: http://www.codeproject.com/Articles/549152/Introduction-to-ASP-NET-Web-API In this project we've changed the find() function of the AJAX script so it only sends one var to our new democontroller.: <script> var uri = 'api/Demo'; function find()...

Multiple Posted Types asp.net 5 MVC 6 API

c#,asp.net,asp.net-mvc,asp.net-5,asp.net-mvc-6
I can use [FromBody] for single type , but is there any way to use multiple? From the searching and reading I've done there is not a way, but i don't know if a way has been added in MVC 6. If not, where would be best to start with...

Access manager information from Active Directory

c#,asp.net,active-directory
Attach is the picture of active directory, which i got from my IT department. Now i want to get the manager information in C#. NOTE: I am able to get all information of user but there isn't any key of manager, but IT department just gave me above attached...

deployment of a site asp.net and iis

c#,asp.net,iis
I know this is for some of you a stupid question but for me is a real problem. I have never deployed a site before What i have done so far: 1) publish the site from visual studio to a folder. 2) added to iis for testing everything works great...

Random Questions keep on repeating

c#,asp.net
I have made a system in visual studio using asp.net(c#) where the questions are taken from database and are displayed to users. but the questions are getting repeated and i can't figure about whats wrong with it and plus some questions are not getting displayed. below is the relevant C#...

Hashing Password in ASP.NET and Resolving it In SQL Procedure

asp.net,vb.net,stored-procedures,hash,password-protection
I'm developing an ASP.NET application using SQL Server Stored Procedures. I need to hash my login password and resolve it in my sp_LoginCheck Stored Procedure. Any suggestions? I have already inserted data in the database. For example: UserName/Password ABC/123456 DEF/987654 I want to encrypt or hash whatsoever the password then...

WebForms: Reference dynamic control

c#,asp.net,webforms
I have a WebForms application that generates dynamic select elements on the page. I don't know how many will appear because that is based on how many records are in the database. Here is part of the code that executes on Page_Load. foreach (int studioId in studioIds) { DataRow studio...

ASP.net website is not working properly while configuring in Internet Information Services

c#,asp.net,oracle11g,iis-7
I have created small webpage in ASP.net using c# in front end and oracle 11g at back end. Webpage is running successfully on my local pc as well as in windows server 2008 r/2 in visual studio 2010. So, i have configured same wabpage in IIS in server 2008 r/2...

Trigger a js function with parameter from code behind

c#,jquery,asp.net,scriptmanager,registerstartupscript
C# Trigger a js function with parameter from code behind. I have the following code: C#: ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptManager1", String.Format(@"ShowHideMessageBlock('{0}')", @"#successMsg"), true); js: function ShowHideMessageBlock(xid) { var c = xid; console.log(c); $(c).fadeIn('slow', function () { $(this).delay(5000).fadeOut('slow'); }); } When I open the console window I get the following message: Uncaught...

ASP.net MVC HTTP Request error with payload

asp.net,json,asp.net-mvc,http
I am creating an ASP.net MVC website with a RESTful API to a SQL database. I have implemented a controller which holds the HTTP commands. One of the commands is a POSTcommand: // POST: api/PoolTests [ResponseType(typeof(PoolTest))] public IHttpActionResult PostPoolTest(PoolTest poolTest) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PoolTests.Add(poolTest); db.SaveChanges(); return...

[OAuth2 authorization server]refresh token's expire time need different with access token?

asp.net,oauth,oauth-2.0,owin
I'm learning OAuth2 via this tutorial, then I found refresh token's expire time is the same as access token, is this correct?

Storing Utc Time in Getter/Setter Property

c#,asp.net,datetime
Currently, I am storing theDateTime with the DeliveryDate getter/setter. However, I'm having issues storing this in UTC time. I've done some research on this and tried DateTimeKind.Utc but can't get that to work correctly. How can I get DeliveryDate to store the DateTime in UTC time? My Code: public partial...

Flipping is not working in IE & Firefox in asp.net

javascript,jquery,html,css,asp.net
I have chart with flippers. it means front portion(z-index: 2) will be text and back portion will be chart. if i mouse over the front, then back portion chart will be displayed(working chrome). But the same is not working IE & Firefox. Please see the attached pic & code snippet,...

How to show unique key exception before saving into database?

c#,asp.net,gridview,drop-down-menu
I've created a gridview in which user can enter items and their quantities. The number of items are unknown so the requirement was that to able to add as much items the users want to. So I've given a provision to add item row for another entry. All these data...

Can I uniquely identify 2 check boxes so that I can add a different image to each?

html,css,asp.net,checkbox
Currently I am using an image for checked and unchecked checkboxes the html and css is below. <div class="text-field-box text-field-box-mobile radio-button-box small"> <asp:CheckBox ID="ChkOffer1" text=" " runat="server" class="checkbox checkbox-mobile radio" Visible="true" EnableViewState="true"></asp:CheckBox> <% Response.Write(Session("Offer1"))%> </div> and css input[type=checkbox] { display:none; } input[type=checkbox] + label { background-image: url("checkbox-default.png"); background-repeat: no-repeat;...

Convert date only to string

c#,asp.net
In my website when a user logs in he sees a 'My Account' page. This information is held in an SQL database. The C# part (relevant code only): public partial class myaccount : System.Web.UI.Page { public string username; public string birthday; protected void Page_Load(object sender, EventArgs e) { username =...

How to enable multiple login tries in asp.net forms authentication?

c#,asp.net,asp.net-mvc,authentication
I have a MVC project with forms authentication. Basically it works fine: The user wants to access a controller with Authorize-Attribute and gets redirected to login-page if not authenticated. On redirect the parameter returnUrl gets forwarded as well. However, in case the first try of the login fails, the return...

How to make a website work only with https [duplicate]

asp.net,ssl,https
This question already has an answer here: How to force HTTPS using a web.config file 3 answers How do I make a website to work only with https? Is there any method to make my website work only if the protocol is https? For example let me say http://www.mywebsite.com,...

can't access a property using <%# %>

asp.net
i was trying to hide and show a button using following code where AllowUpdate is a property of page. now problem is This statement never get Executed. I have used similar code on other pages but it is unreliable many times it just fails and hides buttons even if they...

Formatting dynamically created column

c#,asp.net,gridview
I have a asp grid contents generated dynamically using a sql procedure. using the procedure datatable returned is binded to the grid. In this grid i have a cost column which I like to round to 4 decimal places(12.1234). How to do the same? I tried in RowDataBound as if...

check if file is image

c#,asp.net,asp.net-mvc
I want to check if file is image. and then you will see a link where you can see the image. But the link only has to appear if file is link. I try it like this: if (!String.IsNullOrEmpty(item.FileName)) { var file = item.FileName; string[] formats = new string[] {...

ASP.NET httpHandlers & handlers

asp.net,asp.net-mvc
I am confused about httpHandlers in system.web and handlers in system.webServer. What is the difference between these two configuration? And how and when to use them? Actually another question is for modules as well: httpModules in system.web and modules in system.webServer...

How can I view asp.net Azure internal errors?

asp.net,azure
After uploading my site to Microsoft Azure, server returns this text instead of my site: "The page cannot be displayed because an internal server error has occurred." Where can I see what's the problem?...

Gridview items not populating correctly

asp.net,vb.net
I have data I am trying to input into a gridview. I am looking up the number of rows for the gridview and adding data into them like this: My "test" however does not get populated into the Submitted and Variance BoundFields in the Gridview. All that populates is the...

SQL Server / C# : Filter for System.Date - results only entries at 00:00:00

c#,asp.net,sql-server,date,gridview-sorting
I have a connected SQL Server database in Visual Studio and am displaying its content in a grid. I created a dropdown menu with the column names as selectable options and a text field to filter for specific content, e.g., DropDown = "Start" - Textfield = 14.03.2015 = Filter Column...

How do ASP.NET Web APIs work once built with MSBUILD?

c#,asp.net,msbuild
I'm new to coding and spend most of my time in mobile application development with Phonegap, I've been learning how to code ASP.NET Web APIs and I know how it generally all works while having the code open in front of me but --- I was asked a question today...

OWIN use SignalR and prevent 'HTTP Error 403.14 - Forbidden'

asp.net,.net,owin,katana
I'm hosting SignalR in an OWIN selfhosted app - in Azure, like so: public class Startup { public void Configuration(IAppBuilder app) { app.MapSignalR(); } ... Easy enough, works fine. Exposes /signalr/hubs as expected. What I would like to do is prevent an HTTP 403.14 when someone hits the / url....

Get an Element in a deep stack of Html Elements

c#,html,asp.net,.net
I'm navigating to a website using WebBrowser object in C# and i want to get a Html Element that exist in that website but that element is in a deep ugly stack of other elements in fact the address is : html -> frameset -> frame#mainFrame -> html -> body...

Cannot start Website in IIS - W3SVC running

asp.net,iis
I am trying to start a Website in IIS but it doesn't get started and gives me following error: The World Wide Web Publishing Service (W3SVC) is stopped. Websites cannot be started unless the World Wide Web Publishing Service is running. How can I resolve it? I donot even know...

Images not loaded from master page in directory

asp.net,image
I will make a website whit ASP.NET using C# on the background. I have make my master page with the following image: <img src="afbeeldingen/berichten.png" alt="new messages" /> Because I have a lot of pages in my site, I have make directories in my solution. My problem is now when I...

Retrieve data from one table and insert into another table

sql,asp.net,sql-server
I am trying to retrieve data from one table and then insert it into another table. This is a a sample of the first table in which there is the following data. tb1 is the table which consists of data. The two columns Manager and TeamLeader basically means for example...

An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code

c#,asp.net,visual-studio
I am attempting to multiply the values of dropDown to the user's inputted value in daysRenting. I am getting a format error with respect to the data types being used. dropDown uses doubles and daysRenting is an int. My problem lies in this line of code... How can I rewrite...

Asp.Net Identity find users not in role

asp.net,linq,entity-framework,asp.net-identity
I need to find all users that DONT'T contain a certain role, using Asp.Net Identity. So far I have something like this but it is not working. (From role In context.Roles From userRoles In role.Users Join us In context.Users On us.Id Equals userRoles.UserId Where role.Name <> "SomeRole" Select us.UserName) This...

Callback on client does not get triggered with SignalR

javascript,c#,asp.net,signalr
I'm currently getting up to speed with SignalR, and tried to build a very basic message notification system using the very basic understanding of SignalR that I have but I can't get the messages to come back after the submission. I've read up on numerous blogs on the topic and...

Show/hide tinymce with radio buttons

c#,asp.net,asp.net-mvc,tinymce
I try to show/hide a tinymce with radobutton. Like yes/no. So there are two radio buttons. yes - will show the tiny mce and no will hide the tinymce. I have this: showing tiny mce: <div class="form-group"> @Html.Label(Resources.Entity.Product.PdfMessage, new { @class = "text-bold control-label col-md-2" }) <div class="col-lg-6 col-md-8 col-sm-10...

Split screen into 4 quadrants with a border around each, not working with form tag

html,css,asp.net
I am trying to divide a web page into 4 quadrants. I got this following code from this site. It works as long as the form tag is not added. I want the form tag. How could i achieve a 4 quadrant area with the following code. I am not...

Server side session in asp.net

asp.net,web-services,session
I want to set one value in server side session in client side and need to access that session in web service, so i tried below In client side : //Set the server side session like below var vr_="demo.png"; '<%Session["path"] = "' + vr_ + '"; %>'; //In alert,checked the...

Visual Studio 2012 - Fill message test result

c#,asp.net,unit-testing,visual-studio-2012,testing
When a test end its running i have a list like this Result1 Name: 01- AutoGenerateRequest (requestgenerationtest) Result1 Outcome: Passed Result1 Duration: 0:00:26,2924949 Result1 Message: Result1 StackTrace: how can i write something in the result message or stacktrace?...

Third-party security providers like Google, Twitter etc. in ASP.Net

asp.net,authentication
I have created a standard ASP.Net web project in Visual Studio 2013 and enabled authentication. A class called 'StartupAuth.cs' is created auotmatically, with following lines. When the app runs on localhost dev server it throws an exception as pasted in screen shot below the code. I need to have it...

Need help converting JSON to C# Objects

c#,asp.net,json,object,serialization
I'm currently trying to convert a JSON string into C# objects and currently am experiencing trouble during my debugging. Below is a sample of the JSON along with my classes. Classes public class Timeline_RootObject { public List<Timeline_Frame> frames { get; set; } public int frameInterval { get; set; } }...

OData Endpoint with .NET

c#,asp.net,visual-studio-2013,odata,web-api
I am trying to create an odata endpoint for a table valued function in a database. I am sure with the code, however upon running the application i get the error Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to...

Unable to find control within listview or assign value to navigate url property

c#,asp.net
Hope all is well with everyone today. I have run into a little problem that I am struggling with, I'm sure it's probably something simple but the longer I stare at it the less sense it seems to make. I have a details view, which has in it a listview....

WPF MVVM custom Sorting issue

c#,asp.net,wpf,sorting,mvvm
I am trying to create custom sorting WPF Data Grid. I have did database call on every sorting. I have used MVVM for this. Issue is I am always getting Sort Direction of column always null on sorting event when I make DB Call. If I remove UpdateData method from...

How to generate file selection window in button click?

asp.net
I want to open file selection window, when button clicked. How can I open file selection window without using File uploader control?...

RequiredFieldValidator not working in my ASp site

c#,css,asp.net,twitter-bootstrap
I'm trying to learn some C# & asp, while creating a booking page in Visual Studio. I have faced a little problem with the RequiredFieldValidator, because when i click the button, nothing happens. I'm using the bootstrap css files to make in a little more shiny. Some code of the...

Make uneven table layout

html,asp.net
When I use <table> with <tr> and <td> I always get NxN tables and not what I want. For example: <table border = "1"> <tr> <td> Do you love peanuts? This is a very important question. </td> </tr> <tr> <td> Yes, I do. </td> <td> No, I don't. </td> </tr>...

Database object with different data

sql,asp.net,asp.net-mvc,database,entity-framework-6
I'm making a web page in ASP.NET MVC which compares prices from different shops. I have a one-to-many with products and the shops, where the SHOP has one PRODUCT and a PRODUCT has many SHOPs, the problem is that the product is the same but the price is different. Example:...

Host Four ASP.Net Projects in IIS as single direcory(maintain more projects in same url)

asp.net,iis,hosting,web-deployment
I m having a ASP.Net Webapplication it accessed by from many geography like India,China&America.In that application's login page fields are username,Password & Geography. Based on this login page geography option the application's functionalities will change in all page. In this project,If we add a feature for Indian users but that...

Convert Double from String

asp.net,vb.net,visual-studio-2012,converter
When converting string to floating, the converter creates wrong results. ?Global.System.Convert.ToDouble("635705821821928755").ToString("0") "635705821821929000" ?Global.System.Convert.ToSingle("635705821821928755").ToString("0") "635705800000000000" I am working with VB.Net Visual Studio 2012, Framework 4 on ASP.Net Webpage. Is there any solution for converting huge numbers from string into floating?...

Why is my View not displaying value of ViewBag?

c#,asp.net,asp.net-mvc,asp.net-mvc-4,razor
I have a little blog application with posts and tags. This is my model for Post: namespace HelloWorld.Models { public class Post { [Required] [DataType(DataType.Text)] public string Title { get; set; } [Required] [DataType(DataType.MultilineText)] public string Description { get; set; } [Required] [DataType(DataType.DateTime)] public DateTime PostDate { get; set; }...

why does the compiler complain about missing ctor of WebSocketHandler?

asp.net
I'm trying to use websocket in my project. to do so, I installed the package Microsoft Asp.Net SignalR, which consists of WebSocketHandler abstract class. i defined a class inheriting WebSocketHandler, but then the compiler complains: 'Microsoft.AspNet.SignalR.WebSockets.WebSocketHandler' does not contain a constructor that takes 0 arguments'. It seems wierd to me,...

asp.net get user information from xmlhttp requests

asp.net,ajax,forms-authentication
I am working on an application where certain actions are performed using ajax requests to a backend api page, such as adding likes to content. The javascript function will pass the user ID and content ID to the api page in an xmlhttp request. We use Forms Authentication with Active...

add BR between text in dynamically created control

c#,asp.net
I've got a dynamically created List in asp.net with the following code: HtmlGenericControl li = new HtmlGenericControl("li"); li.ID = "liQuestions" + recordcount.ToString(); li.Attributes.Add("role", "Presentation"); ULRouting.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); li.Attributes.Add("myCustomIDAtribute", recordcount.ToString()); anchor.InnerText = "Test " + new HtmlGenericControl("br") + "12345"; li.Controls.Add(anchor); I tried to put in a HtmlGenericControl but...

System.net.http.formatting causing issues with Newtonsoft.json

c#,asp.net,asp.net-mvc,json.net
My Windows service is in the same solution as a MVC project. The MVC project uses a reference to SignalR Client which requires Newtonsoft.Json v6 + the Windows service uses System.Net.Http.Formatting, which requires Newtonsoft.Json version 4.5.0.0. I assumed this would not be a problem, as I could just use a...

Nested repeater and datasource

asp.net,webforms
I have a repeater nested in an other repeater. My question is: is it possible to generate other ItemTemplate components with datasource. If yes, how can I do it ? For example: ItemTemplate1 of parentRepeater A B C ItemTemplate2 of parentRepeater D E F It means that ItemTemplate of childRepeater...

Bootstrap Smaller Navbar Collapse Width

css,asp.net,bootstrap
i have a problem i was searching all day for answer and did't find it. The code: <div class="visible-xs navbar navbar-ti navbar-fixed-top "> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle pull-left" data-toggle="collapse" data-target="#navbar" > <span class="glyphicon glyphicon-menu-hamburger white"></span> </button> <button type="button" class="navbar-toggle collapsed pull-right"> <span class="glyphicon glyphicon-search white"></span>...

Select @field From table as parameter

asp.net,sql-server,parameter-passing
I have a database table with some columns like "col_a", "col_b" and I want to retrieve just one column of it. But the column is depended on some user selection. Some times could be the col_a, the col_b, c .... So my question is if I can select a field...

How to select rows from a DataTable where a Column value is within a List?

asp.net,.net,vb.net,linq,datatable
Say you had a table in SQL and you wanted to find all the rows where a particular column could be one of 3 options. You could write something like this: SELECT * FROM MyTable WHERE uid IN (123, 456, 789) That's effectively what I want to do with a...

Getting a JavaScript object into my controller: What am I missing here?

c#,asp.net,ajax,json,asp.net-mvc
I'm getting a 500 (Internal Server Error) when I try to run $.ajax({ xhr: function() { var xhr = new window.XMLHttpRequest(); return xhr; }, type: 'POST', url: '@Url.Action("MyAction","MyController")', data: fi, contentType: "application/json; charset=utf-8", dataType: "json", // dataType is json format success: function(retJson) { // ... } }); where fi is...

Unable to make parent li active on click of child li with bootstrap in mvc4

c#,asp.net,asp.net-mvc-4,c#-4.0
I have search and try different method like using JQuery Helper class etc but i can't find solution for my scenario. My code is below I want Active li when i user select and page refresh <aside class="main-sidebar" style="background: #102C4B none repeat scroll 0% 0%;border-right: 1px solid #DCE1E4;"> <section class="sidebar">...

UpdatePanel AsyncPostbackTrigger not firing

asp.net,ajax,webforms,updatepanel
I've got a little problem, any help is appreciated. Situation looks like this: <asp:UpdatePanel ID="UP_Panel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlSwitch" runat="server" Width="250px" AutoPostback="true" OnSelectedIndexChanged="ddlSwitch_SelectedIndexChanged"> <asp:ListItem Value="continent" Text="Continent"></asp:ListItem> <asp:ListItem Value="region" Text="Region"></asp:ListItem> <asp:ListItem Value="country"...

c#,html,css,asp.net,ascx
The text inside the button jerks or moves down by few pixels. <div> <asp:Button runat="server" ID="Button1" CssClass="ButtonClass" Text="" runat="server" /> </div> ascx.cs: Button1.Text = LocalizationResourceManager.GetLocalizedValue("Button_Text"); CSS: .ButtonClass{ background: url('/Button.png') no-repeat scroll 0 0 transparent; cursor: pointer; font-weight: bold; font-size: 14px; height: 33px; padding-bottom: 7px; padding-right: 19px; width: 180px; border: solid...

Show jQuery loading progress before page fully loaded

jquery,asp.net,requirejs,domready
I am using requireJS domReady plug in to show jQuery loading progress on asp.net web page. Here is the code that I am using, require(['domReady'], function (domReady) { domReady(function () { //Hide jQuery loading progress }); //Show jQuery loading progress }); Problem: jQuery loading progress is showing good, but it...

Binding my view model to a view causes all check boxes to be checked

c#,asp.net,asp.net-mvc,asp.net-mvc-4,razor
I'm having an issue where my all the check boxes rendered in the view are coming out checked. I put a breakpoint at the line where my view model is constructed and through the debugger, I can see that some values are set to "true" and others are set to...

Mvc Remote Attribute is sending “undefined” in query string

c#,asp.net,asp.net-mvc,asp.net-mvc-4
I'm trying to remote validate some code and for the parameter, its passing undefined in as a parameters. Here is my validation code: [OutputCache(Location = OutputCacheLocation.None, NoStore = true)] public class ValidationController : Controller { public JsonResult IsUserNameAvailable(string userName, int? UserId) { var users = new BusinessLayer.BdsAdmin.Users(); if (UserId ==...

WebMethod having array as a parameter

asp.net,web-services
I want to write a web method having its one argument as an Array/List. The code builds successfully but on browser to test it shows following message. The test form is only available for methods with primitive types as parameters. [WebMethod] public string Concat(params string[] arr,int a,int b) { string...

SimpleMembershipProvider WebSecurity.InitializeDatabaseConnection The login from an untrusted domain

asp.net,database,exception,model-view-controller
I export the database to the server and i've problem. When I start application i see this error An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. WebSecurity.InitializeDatabaseConnection("DefaultConnection",...

List/Array of dates to be used by jQuery

jquery,asp.net,arrays,razor,webmatrix
I'm after some guidance. I have a SQL select statement which pulls a bunch of dates out of my database. I then need to put them into an array or list (i'm not sure which would be best) so that it can be consumed by a jquery script (which will...

Enter causing postback even if no submit button is present

javascript,jquery,asp.net,forms
I have a form in asp.net page. Whenever enter key is pressed the page is posted back. I don't have any submit button in my form and using javascript to submit form. <div class="row-fluid" align="center"> <a id="saveConfirm" class="textDecorationNone"> <div class="btn btn-primary"> <i class="icon-ok icon-white"></i>&nbsp;Add </div> </a> &nbsp; <asp:LinkButton ID="btnCancel" runat="server"...

Sending file to print not working using System.Drawing.Printing

c#,asp.net,printing,system.drawing,printqueue
I'm trying to send a file to print without opening it trough Adobe as suggested by several Answers here; instead, I'm using the PrintQueue library (from System.Drawing.Printing). What I've accomplished so far: I have the correct PrintQueue referenced as pq: PrintQueue pq; //Assume it's correct. The way to get here...