Newest 'asp.net' Questions

Q&A for professional and enthusiast programmers

unable to call log off method in asp.net core

I use this code to logout from dropdownmenu but didn't work <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>

How to find all textboxes in a gridview row?

I have a GridView on a website, that have different controls in each row (eg.: textbox, label, dropdownlist). I need to find all textboxes and set the enabled property to false, so the user won't be ...

How to post JSON data to code-behind. After that, insert into DB.?

i would like to know on how to pass my JSON to code behind and then once its at code behind, i would like to run through the entire json file again so as to filter out the database table name and ...

Don't generate blocks without values (ASP.NET MVC)

I have back-end code here is code [HttpGet] public ActionResult QuestionBlocks() { var _id = TempData["ID"]; var questBlock = db.QuestionBlocks .Where(x => x....

How to create same name method with extra parameter in C#? [on hold]

I have an existing method with two parameter on a class that already used by others.Now without changing this method and the code where this method is called, I have to create another method with same ...

ASP.NET Getting value from gridview

Here is my code protected void GridView1_DeletingRow(object sender, EventArgs e) { Functions con = new Functions(); SqlConnection con1 = con.get(); con1.Open(); ...

Add checkboxfield and hidden field in template field in gridview

I need to set column index in checkboxfield in gridview.Iam uable to set column index on hidden field as well. Is there any way to set column index in checkboxfield?otherwise how can I add ...

VS 2017 .NET 4.6.2 new ASP.NET Core Web Application (.NET Framework) defaults to x86 platform

Why? Web Application (.NET Framework) and Core Web Application (.NET Core) both target AnyCPU platform. Is this a bug or is there some value in doing this? I'm on Windows 10 x64 and have installed ...

ASP.NET - How to reference a LinkButton within ListView

I've created a ListView with a dataset and I'm wondering how to reference to a LinkButton within a ListView, since I can't reach it in code behind. The LinkButton is within ItemTemplate. I need to ...

ASP.NET MVC 5 IdentityUsers has Post. How can I assign posts to user?

I want to create something like a blog application. User signs in and can add a post. This post is assigned to him (there is a relation one to many). The post can have comments. I am using scaffold to ...

calling ajax server-side method with mappage route c#

Salam aleykum, i'm trying here to call an ajax server-side method using the mappage route but it always says: POST 404 (Not found) here is the code c#: [System.Web.Services.WebMethod] public ...

Parser Error in page definition

I get the following error: Server Error in '/' Application. Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review ...

File inserting into filestream directory, but not into SQL Server 2012 table. C# ASP

I'm having difficulty setting up my database to accept files. I don't fully understand what I'm doing so it will be something silly for sure. I'll try to include as many images and as good a ...

convert a jpg/png/txt or any file format to pdf using mvc5

How do i convert a jpg/png/txt or any file format to pdf using mvc c#. Here is the code: public ActionResult SaveProfileDocument(string code) { bool isSavedSuccessfully = true; ...

How to download file which is stored in folder on button click in windows application form c#

How to download file which is stored in folder on button click in windows application form c#. I am developing a windows application form in which i want to download excel sheet which is in my ...

what are the best and the easiest javascript charts libraries to use with asp.net using vb.net

what are the best and the easiest javascript charts libraries to use with asp.net using vb.net ?

Swagger ignores xml parameter tag

i am using Swagger + xml comment file for my Asp.net webapi documentation. The value in the summary tag is displayed, but the param tag gets ignored. I have an OdataController v4 // GET: api/...

Search - Open new page and give gridview or html with searched content

for I've tried to make a searching option on my website that I need to create for my finals. At the moment it's not working but I created a bit of code. I've also made a specific search.aspx page ...

Reverse proxy and in-process HTTP server in Asp.Net Core

I was reading about Kestrel web server in asp.net core app specifically the in-process http server and reverse proxy. Being a seasonal web developer, I have trouble in understanding the notion behind:...

pdf download on page load event -asp.net

I have an aspx page when a link is clicked it will redirect to another page, and when that other page loads I want to download pdf automatically (in page_load). I wrote the download code in page_load. ...

How to resolve 'System.Access.ViolationException' occurred in WcfSvcHost.exe

I'm getting this error when I run my project on VS 2013. I know same question is asked multiple time but I tried all possible answer no answer worked from I m trying to solve this from last 5 days ...

How to validate phone number by regex in C#? [duplicate]

I am using below regex to check phone number is valid Regex.Match(number, @"^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$").Success but it does make invalid for phone number like +...

Comparing two lists by specific criteria and updating/inserting records for the matched criteria

I have written a code/database design where I have following classes mapped in my application: public class Items { public int ItemsId {get;set;} // suppose this is the PK in my table public string ...

How do I manage the per web request scoping for an Asp.Net Core app when I share Ninject modules that are already used by several other apps?

I have a bigger consisting of shared libraries and different host applications. For now I have bindings like: Bind<IUserService>().To<AspNetUserService>().InScope(RequestScope); Or: ...

Generate SAML OAM metadata that works with asp.net web forms project

I am trying to configure a web application using ASP.NET for Single-SignOn with OAM based system. To configure their OAM, my client asked me to provide a SAML Service Provider metadata file matching ...

How to get more than 10 items from AWS api ItemSearch?

Is it possible to get more than 10 items per request using Amazon Product Advertising API ItemSearch? For example we have this link: https://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Daps&...

Create an excel using itextsharp and save it on server folder

i want to create an excel file using itextsharp and want to save it on server in a folder. DataTable dt_final = get_gridview_format(); for (int i = 0; i < gridreport.Rows.Count; i++) ...

How to set Checkbox value in Word document using OpenXML

I have been trying to get this to work for days now and am posting here as a last resort. Background - I am creating a web application that allows a user to enter data into a web page and this data ...

SQLDataSource FilterExpression DataView - Cannot find column [myColumn]

I'm trying to do a SQLDataSource.FilterExpression as follows: SqlDataSource view = new SqlDataSource(){ID = "view"}; this.Page.Controls.Add(view); view.ConnectionString = ConnectionBDD.BDD; ...

Not able to insert records into database with asp.net

I want to insert records in my database with asp.net, but it is not really working out well. The data types of the colums in my database are all varchars, except for the randomID. But I still get this ...

Asp.net Core connection string in Model

I have been wanting to use connection string to get data from my database. I added connection string in appsettings.json as "ConnectionStrings": { "MyDatabase": "Data Source=DESKTOP-SD0U3IK;...

How to create separate pages for form and gridview in ASP.NET

I have created a form in ASP.NET web forms which details are filled out and when press save it is redirect to another page in which GridView is located. My problem is how to connect these two. If I ...

Unauthorized response after setting CachePolicy with HttpClient

I am sending a GET request to a server which expects NTLM authentication. For that we set UseDefaultCredentials = true var defaultHandler = new WebRequestHandler { UseDefaultCredentials = true, ...

Currency Format Failing on View Component - Work Arounds?

I have searched a lot. Perhaps I am looking in the wrong places... I have a product list and cost price within the product list. An extract from the Model: [Display(Name = "Cost Price")] [...

Length cannot be less than zero. Parameter name: length when trying to split token

hello i have this line of code am trying to split the tokens gotten from the http readerGetResponse stream, whle breaking the code it shows this error "Length cannot be less than zero. Parameter ...

How to call out a web form from current web form?

First web form: public partial class Product : System.Web.UI.Page { //------------------------data variable------------------------------// public static double pheight; public static ...

Having an issue while binding data to gridview

I have a model public class ItemHistory { public int TotalItems; public int ScannedItems; public int PendingItems; } on button click event i want to load a grid depending on that values. ...

Azure DocumentDB Read Document Resource Not Found

I'm building a .Net Console application to read information in a DocumentDB. The console app has data coming from an EventHub and inserts/updates recent data as it comes into the cloud. I am trying ...

SQLCommand update query in batches

I have written a code like following: for (int i = 0; i < ListToUpdate.Count; i = i + 500) { SqlCommand command = new SqlCommand(); command.Connection = new SqlConnection("Data Source=.;...

I want to show data in gridview even if only one dropdown is selected

My form is working properly but the only problem is the i want to make that the gridview should also visible when i select only one dropdown. The below dropdown is just a one sample of my code. I ...

ASP Repeater - Get generated element ID

I have an ASP Repeater that generate divs that will be later filled by a js script (the script draws a bar chart, for clarity sake). I need the id of those divs so the js script can target them. The ...

Force culture/multilang page when requesting non-culture page

On my Umbraco site, is it possible to force a redirect to the default multi language page for all pages, if someone tries to visit the page without the multi language part in it? Here's an example: ...

Set Encrypted connection in web.config during wix installation

I have got a web application which is using base 64 encrypted connection string. <add name="connString" connectionString="r5IJ/jyd79T65xiCQ5c6m2vj6B9rVjFMfYiOW7WcpDDVZNJcQGDJfaO6kYfNCvlGXYthl+...

Asp.net mvc 301 redirect

I have one website with ssl certificate. The domain is http://example.com I have one sub domain http://api.example.com which has not ssl certificate. So i want to redirect my http://example.com to ...

HOW TO: FIX ERROR - “the 'microsoft.ace.oledb.12.0' provider is not registered on the local machine”

While uploading excel this issue is raising. I set Application pool 32 bit false and it works fine. After two weeks it again raising the same issue.

https on default ASP.NET MVC

I have ASP.NET MVC web app. When I upload it on azure web app, web site has http:// I need it to be https:// always. How I can do this? I know that it may be too broad question, but can you give ...

Cannot implicitly convert type 'system.web.ui.control' to 'system.web.ui.webcontrols.checkbox

int i = 0; for (i = 0; i <= dt9.Rows.Count - 1; i++) { CheckBox ch = new CheckBox(); ch = Page.FindControl(dt9.Rows[i].ItemArray[0].ToString()); <--- ERROR ch.Checked = true; ...

Closest location based on Lat/Lng from database

I have a list of Longitude and Latitude values in a database which i have obtained using Google Maps. Within my ASP .Net site when a customer searches for an address and it doesnt exist in the ...

Configuration section not allowed to be set below application - Error Code 0x80070021

supposedly godaddy did a cache refresh, which I would not think change any basic parms or website setup but now 2 applications don't run found this post: 0x80070021 Server Error in Application "...

Splitting of text file not working properly in c#

I have requirement of writing to text file. If the file size exceeds 700MB, create new file & write to it. I am currently writing data with “|” delimited from database to file & after that ...
Translating... 0%