Most voted "c#" questions
This tag should be used when the question refers to some resource, information or problem related to the C#language. C# ("C Sharp") is a multi-paradigm programming language that has strongly typed variables, is imperative, declarative, functional, generic, object-oriented and component-oriented, which are designed to be executed in . NET Framework.
Learn more…13,899 questions
Sort by count of
-
3
votes2
answers485
viewsTwo parameters with String.Format in an Asp:Hyperlink
I would like to send the parameters (database ID, Clientid) in a <asp:Hyperlink. I wanted the end result to be: <a id="ctl00" onclick="OpenModal(704520,'asdf_ID_DaImageAbaixo')"> <img…
-
3
votes1
answer9340
viewsCheck if the given value is numerical and has 9 characters
How can I verify if a value is numerical, and only numerical (without occurrence of points, strokes, etc.), regardless of the amount of characters that the number contains, besides having exactly 9…
-
3
votes2
answers650
viewsCreating custom Annotations in ASP.NET
I own a Controller in my project Asp.net (Web Service) I need to do a token check for each method request. One solution I found is to create a static method and place a call at each start of each…
-
3
votes2
answers181
viewsConfusing encapsulation in c#
I was creating a model that in his construtor i defined the attribute Nome. however this attribute will only have the get, as different from java c# has the resource for getters and setters I…
-
3
votes2
answers330
viewsDisplay layout only when view is not loaded via ajax
In my project, I am developing so that the application works even if the user is with Javascript disabled or unavailable. If Javascript is not available, I load the page normally. If available, I…
-
3
votes3
answers3820
viewsChanging LABEL value by Jquery or Javascript does not work in ASP.NET
Use this JS function in ASP.net: function habilitado(){ var b = document.getElementById('<%= Label4.ClientID %>').value = "Habilitado"; } I call it that in codebehind. The value of the label…
-
3
votes2
answers2290
viewsCan I use the same WPF view for Desktop and Web?
Dear ones, I have never programmed with WPF but soon I will have the opportunity and already thinking about the future, which is now, in which desktop applications will be/are being migrated to the…
-
3
votes4
answers1320
viewsLong processes in C#
I need to do a routine where the user will upload a data load file, and C# will process it and save it in the database, without giving time-out and showing the process progress to the user. My…
-
3
votes2
answers985
viewsHow to export an HTML/C#(Razor) page to PDF?
I have some simple tables and need to export them to PDF. I found the library itextsharp, but in the compressed file there are many folders and files and do not know how to add the reference in my…
-
3
votes1
answer898
viewsHow to pass checkbox list to Actionresult
I need to know how to pass the values of inputs checkboxes to the action Edit, need to pass the properties Checked and Id and store in a list of type Photo. Noting that the controller that this…
-
3
votes2
answers239
views -
3
votes2
answers2189
viewsConvert Date dd/mm/yyyy to ISO 8601 format (yyyy-mm-dd)
I have a field called maskedTextBox2 in C# Windows Form, which contains a date mask in the format dd/mm/aaaa. How can I convert this string format aaaa-mm-dd to save to Mysql database, which uses…
-
3
votes4
answers3125
viewsDealing with collisions in Dictionary C#
I need to map a string array to a dictionary so that I can later test whether an informed string is valid by checking if it is part of the dict, additionally would like to recover some other…
-
3
votes2
answers134
viewssubtraction of two double properties[]
I have a class called functions.Cs I need to create a property that stores the initial X,Y and final X,Y values, I thought: public double[] PosicaoInicialXY { get; set; } public double[]…
-
3
votes1
answer151
viewsSerialize XML and save to Oracle with C# and ADO
I wonder if there is something equivalent in Oracle for this select in SQL Server: select NickName, ExternalId1 from Basics where externalId1 = @externalId1 for xml auto, elements; And to this…
-
3
votes2
answers3712
viewsPreventing data forwarding when updating page (F5) in ASP.NET
Guys, I have the following problem: I have a web application made with ASP.NET and C#. In this application I have a simple entry registration system. After I register an item in the application, if…
-
3
votes2
answers2905
viewsAutomato for navigation in a Webforms application
Guys, it wasn’t the first time or the last time I had to implement an automatic routine that accesses a website or system created on the Webforms platform to capture information. It has been…
-
3
votes1
answer261
viewsXML returning incorrect values
I’m trying to do a show on c# to test the codes needed to run a xml, read your data and enter it in a list. But for this, I preferred to use a MessageBox to do the debug first. Man xml is a RSS Feed…
-
3
votes1
answer1763
viewsSelf relationship at EF6
I need to make a relationship in one of the entities, as I do to reference the entity itself for both child records and parent record public class Comentario { public int IdComentario { get; set; }…
-
3
votes1
answer295
viewsMap a CHAR-like field in the database to a bool-like field in C#, with Fluentnhibernate?
In the database I have a field ATIVO of the kind CHAR(1), where 'T' = true and 'F' = false. Today, in my application I am circumventing this problem with a "gambiarra", where I mapped my attribute…
-
3
votes2
answers3307
viewsChange Oracle session to accept comma and dot number in C#
When opening an oracle connection on C#, I need you to . and the , behave according to the rule 0.000,00 a real number. I would like to know how to change this format in the open session on…
-
3
votes1
answer118
viewsASP.net MVC with WIF
When searching the web, I saw that it is not possible to register Assembly’s on the Razor view engine on Asp.net mvc as was done on webforms. <%@ Register TagPrefix="wif"…
-
3
votes1
answer5051
views -
3
votes2
answers247
viewsUpdating treeview
I have an application that uses a treeview as image and code below. ASPX: <%@ Page Title="" Language="C#" MasterPageFile="~/FrontPage.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs"…
-
3
votes1
answer469
viewsProblem with Custom Routes and Httphandler in ASP.NET MVC
On a project I’m working on, I wrote a HttpHandler to bring as a response an image instead of a View, sort of like this: using System; using System.Web; using System.Web.Routing; using…
-
3
votes1
answer2186
viewsHow to use generic types with type parameters?
I have a dictionary that serves as a type mapper with C#. var Map = new Dictionary<Type, Type>() { {typeof(A1), typeof(A2)}, {typeof(B1), typeof(B2)}, {typeof(C1), typeof(C2)}, {typeof(D1),…
-
3
votes1
answer1354
views -
3
votes1
answer537
viewsCan I fill a Datagrid with a List<T>?
How do I fill one DataGrid from a List typical? It would be possible to generate the columns automatically?
-
3
votes1
answer105
viewsEncryption error in c#
Hello! I’ve tried to analyze the code but I can’t find the answer using System; using System.Collections.Generic; using System.Text; using System.Linq; using System.Web; using System.IO; using…
-
3
votes2
answers4464
viewsGetting the full path of a client file in ASP.NET
On the server side, you can get full path of a file sent by a client using the tag <input type="file">? For example, if the user sends the file C:\Users\Documents\a.txt, has how the server can…
-
3
votes1
answer290
viewsQuestions regarding the use of . dbml files
I took a system in aspx(VS2008) and I will have to make some improvements, add other features and all this using MVC5. Well, there’s a web service, there’s a guy like that: static…
-
3
votes1
answer694
viewsHow to repeat HTTP requests multiple times and simultaneously without delay?
I need a way to send http request’s several times, without change of any request. Currently I have used Charles Proxy - I take the request of an iPhone app and so I can repeat it on my computer.…
-
3
votes1
answer104
viewsDisfigured ASP.NET routes
From trying and searching I think I’ve disfigured something important, so I can’t make the routes work. In this image it appears that the form is being posted to the Loginprofessional controller in…
-
3
votes2
answers1328
viewsHow to make a user helper logged in to Asp.NET MVC 4?
I need to implement a Helper for logged in user, ie a static class that returns information about the logged in user from context. The idea is to use the information both in Controllers how much in…
-
3
votes1
answer107
viewsAlign Popup to Center
Why can’t I line up at the center, that my popup? Look how he looks in XAML Design Follows my XAML: <Popup x:Name="popup" HorizontalAlignment="Center" VerticalAlignment="Center">…
-
3
votes5
answers1054
viewsContains in Class List
I have my class, which has 2 classes within it. public class ProfEsp { public Especilidade Especialidade {get;set;} public Profissional Profissional {get;set;} } public class Especialidade { public…
-
3
votes1
answer895
viewsEdit data from a combo box
I’m having a problem with my Asp.net mvc application. What’s going on is that when it comes to saving the data, my combo boxes carry data from enums. These combo boxes are from an application to a…
-
3
votes1
answer2677
viewsPrint Screen and save image automatically in C#
It is possible to take a print screen of the active page of my web system and save that image somewhere using c#?
c#asked 10 years, 4 months ago Flávio Santana 105 -
3
votes2
answers673
viewsCheckboxlistfor with error
Description: Error when compiling a resource needed to fulfill this request. Examine the error-specific details and modify the source code appropriately. Compiler Error Message: CS1061:…
-
3
votes3
answers9298
viewsReturn the previous page with the back button
I have a back button that is supposed to return to the previous page, regardless of which page is on the system. How can I do this using MVC 4? The returnURL has something to do with this feature?…
-
3
votes2
answers2764
viewsIF condition inside _Layout.cshtml in MVC
I have two _Shared.cshtml (MVC masterpage type, do not know the name) and both are virtually equal, only the menu left is different. I would like to do only 1 and according to the querystring I will…
-
3
votes1
answer144
viewsBest practice action result targeting
I need to direct the administrator to a location, the first-time student to another and the student who has already accessed, to another. My validations are working, everything is going well.…
-
3
votes2
answers2101
viewsHow to decode an image in Base64
I’m trying to decode an image, the string that comes as a parameter in the Image attribute of the post object looks like this: "data:image/png;Base64," and a lot of letters, numbers, and symbols on…
-
3
votes1
answer416
viewsSslstream - Certificate
1 - To make a secure communication between a client and a server, I decided to use SSL using Sslstream, from example msdn site, but the issue is that it is not a server on the web, even not being a…
-
3
votes4
answers5635
viewsMake a regex to remove characters
In a return of a jquery function, the date returned comes in this format. /Date(1401731794773)/ I would like to remove the invalid characters on that date, which are: /Date( and )/ I only need the…
-
3
votes2
answers340
viewsIs it bad practice to use foreach inside the View?
It’s a bad practice to use foreach within the View? If it is, how to do it?
-
3
votes1
answer68
viewsEntityframework 6 - Load Model and its dependencies in Home
I have a college project where I decided to do a blog. Something very simple, author, post and comments. only these three. Well First I wanted to home of the project he carried the Posts (Articles)…
-
3
votes1
answer3372
viewsHow to make a complex SQL query in . NET MVC
I would like to know how to make a query, using multiple fields, multiple tables with Inner joins in ASP.NET MVC without having to put the SQL string in the code, using the Entity Framework. At the…
-
3
votes2
answers2435
viewsGenerate reports in c#
someone can tell me a free report generator for .Net. For example, in Java I know Jasper who is very good, but for . net I’m not finding anything. What I need is a simple report, looking at a table…
-
3
votes2
answers426
viewsAre Service Layer and BLL the same thing?
I have a question about service Layer and BLL, what’s the difference? where it’s used? I would like an example of classes using these structures.