Questions tagged [c#]

C-Hash (pronounced "C-dialect") is an advanced, statically typified programming language with versatile paradigms crafted by Microsoft. C-Hash code typically serves the purpose of Microsoft's assortment of tools and runtimes such as .NET, .NET Framework, .NET MAUI, and Xamarin. Feel free to employ this label for inquiries pertaining to coding in C-Hash or its official specifications.

refreshing treeview without reloading the page

In my implementation, I've included an UpdatePanel that contains a TabContainer, which in turn houses a Panel. Within this panel, there is a TreeView that I must maintain the order of. Now, going back to the contents of the UpdatePanel, there's a ...

Steps for accessing the search input box in Office365 Hotmail:1. Open your web

I'm having trouble with automating the process of opening an email through searching for the email address. Despite trying various XPaths and Actions, I can't seem to click on the search box. Can anyone provide assistance? This is being done in Chrome Bro ...

How to effectively utilize the Twitter API with C# - a comprehensive guide

Seeking guidance on utilizing the Twitter API with C#. Currently struggling to find relevant information. ...

Passing all selected items from a list to the controller

I am currently facing an issue with my two multi-select lists. One list contains a full list of names while the second one holds the names that have been selected from the first list. The names are stored in a Vue array which populates the names into the s ...

The Ajax.ActionLink feature is causing the entire view to be duplicated and inserted into a <div> within the same view

Recently, I started learning MVC and taking on the task of developing an e-commerce application for my aunt's business. The challenge arises with a Product List page that includes a menu to search by category as a partial view. Initially, everything s ...

"Repeating SignalR Messages: Issue of Duplication when Stopping and Restarting

Whenever I stop and start the connection, messages sent to the client by the hub are duplicated. If I follow this sequence: $.connection.hub.stop() $.connection.hub.start() {...} and a message is sent from the server hub to the client, it is initially re ...

Guide to showcasing images dynamically in Angular using .NET Core API and database

I am looking for a way to showcase an image that is stored in the database. Below is the code snippet showing how the image file gets uploaded to the database. public string UploadImage(IFormFile file) { if (file == null) thro ...

Unable to load the file or assembly 'SeleniumExtras.WaitHelpers' was unsuccessful

I am attempting to utilize wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementIsVisible(By.Id("logonIdentifier"))); However, I am encountering an error stating 'Could not load file or assembly 'SeleniumExtras.WaitHelpers'. My projec ...

variances in CSS performance between local and remote hosting

My team and I are all using Internet Explorer 8 on Windows 7 Professional, with Visual Studio 2010 Premium. However, we have noticed that when running our application in localhost mode versus remote mode (on the server), there are differences in the CSS re ...

How to Fetch Byte Image with Ajax and Display it on the Client Side in ASP.Net MVC

After converting an image to bytes, I am facing the challenge of displaying the byteImage in a browser. I have two sets of data, one being the Image ID and the other being the Image_name, which are displayed in a table. However, I am unable to display the ...

In C#, deserializing a JSON string without a field name requires a different approach

Typically, when working with APIs and receiving a Json string, I create a class that matches the structure of the string and then populate that class using JsonConvert.DeserializeObject from Newtonsoft. However, in this particular Json string, one of the ...

Guide to fetching and displaying a PDF file in the browser using Vue.js and Axios

Despite successfully using Axios to download a pdf file on the browser with correct page numbers and orientation, the content appears to be empty. Here is the API code snippet: [HttpGet] [Route("~/api/Document")] public HttpResponseMessage Get(in ...

Receiving NullReferenceException when attempting to access Firefox logs with Selenium in c#

I am currently working on a project that involves recording log files in Firefox using Selenium with c#. To test this functionality, I have created a basic example to open a browser and retrieve the logs. However, I encountered an issue with a 'Obje ...

Select all elements in a column using Selenium in C# when two specific conditions are satisfied (Multiple Conditions)

My task is to extract all elements from the td of an HTML table. However, when I attempt to locate elements by xpath with multiple conditions, it fails and retrieves 0 elements. I have no issues retrieving all values with a single condition, indicating tha ...

Instructions on setting up a Newtonsoft JSON converter to convert a sophisticated data structure into a more straightforward format

I am interested in implementing the Enumerations library found at https://github.com/HeadspringLabs/Enumeration. Currently, when attempting to serialize/deserialize an Enumeration, it is serialized as a complex object. For instance, taking the example of t ...

Utilizing DataTables.Net Editor for AJAX data submissions within a C# MVC controller

Hello there, I am currently utilizing the Datatables.net editor jQuery plugin in a C# project. I have a question regarding grabbing the data/value of keyLastName from an AJAX post in order to add it to the Editor's WHERE clause within an MVC Controlle ...

Parsing a diverse JSON array into a variant List<> with the help of Json.NET

I am faced with a JSON-array that holds objects of various types with different properties. The key property, "type," determines the nature of each object within the array. Take a look at an example snippet of my data below: [{ type : "comment" ...

The current JSON array is unable to be deserialized (for example, [1,2,3])

I am facing a challenge with JSON data and its corresponding model. Here is the JSON data: [ [ [ { "origin": [ -15.2941064136735, -0.43948581648487, 4. ...

Transmit XML data from controller to JavaScript

My goal on the UI is to display a formatted XML string when clicking on a link within a table of objects. I have tried passing the XML string to the View via a ViewModel and then setting it as a data attribute for the link. When clicked, JavaScript reads t ...

Angularjs is encountering an issue because there is no 'Access-Control-Allow-Origin' header on the requested resource

Encountering an Issue: Getting the following error message: Failed to load http://localhost:10948/Api/Home/PostData/[object%20Object]: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:57580' is there ...

The JSON outcome lacks a constructor that supports 0 arguments

While trying to create my JSON action, I ran into an issue. The problem lies in the fact that when I try to return a JsonResult, it is being flagged with an error message stating 'JSON result does not contain a constructor that takes 0 arguments'. I am un ...

Using a custom JsonConverter, learn the steps to deserialize a specific child object in Json.NET

Deserializing JSON from a web response is my goal. Here's an example of a typical response: { "response": { "garbage": 0, "details": [ { "id": "123456789" } ] } } The current format ...

Extract the HTML content from a website that is dynamically rendered using JavaScript

Follow this link to access a document in an open nutrition database: http://www.dabas.com/ProductSheet/Detail.ashx/124494 I am attempting to extract data from this page using xpath. The issue arises when I attempt to view the page source to identify the ...

Using nested JSON in POST request input

When utilizing Fiddler to invoke my method, I am now facing an issue with the parameters. The structure of these parameters is as follows: {"timestamp":"", "json": { "something":[{"text":"bla","status":"1"},{"text":"sfdf","status":"1"}], ...

The AJAX request is not triggered before the postback when using a LinkButton in ASP

I am facing an issue with running an insert statement using a button in my application. Although it is functional, I have noticed that whenever I click the button, the Page_Load function runs before the ajax statement executes. How can I ensure that the a ...

GraphQL .Net Conventions do not allow variables to be of a non-input type

Recently, I have been working on implementing graphql.net using conventions. The model that I am working with is defined as follows: public partial class Project { public Project() { ProjectGroup = new HashSet<ProjectGr ...

The functionality of SelectByText (partial) in C# Selenium WebDriver bindings appears to be malfunctioning

I am currently facing an issue using the Selenium WebDriver Extensions in C# to select a value from a select list by matching partial text. Despite trying different approaches, I can't seem to get it to work as expected. Could this be a mistake on my end o ...

Is there a pub/sub framework specifically designed for managing events in Angular?

Having a background in WPF with Prism, I am familiar with the IEventAggregator interface. It allows you to define events that can be subscribed to from controllers and then triggered by another controller. This method enables communication between controll ...

The method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not provide any output

After running all JavaScript, I need to retrieve the HTML content. However, I am facing an issue using WebKit.NET where the method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not return anything, even with a simple alert(). When I try passi ...

Struggling to Transform XML into a Text Input within a C# SOAP Web Service Function

Recently, I was tasked with developing a C# SOAP Webservice that is capable of converting data from JSON to XML and vice versa. So far, I have successfully implemented the service along with two methods. The conversion method from JSON to XML is functionin ...

Obtaining nested div values using selenium in C#

On my HTML page, I have the code snippet below: <div class="Test_cWidgetContainer" id="479b9c05-3f2b-43a1-c24d-89f574673326" draggable="false" style="background-repeat: no-repeat; background-position: center center; background-size: 100% 100%; backgrou ...

Converting synchronous Python methods into asynchronous tasks

Have you heard of the Task.Run method in C# that accepts a delegate as a parameter and returns a task that can be awaited? Check it out here. Now, I'm wondering if there is a similar feature in Python's asyncio module. I have a synchronous block of code ...

Tips for getting UpdateTargetId to function properly in Ajax.ActionLink!

Within the controller, I have a method like this: [HttpDelete] public void DeleteDocument(int id) { //Handling document deletion in the database } In the view, there is a call to a method that returns a partial view: @{ Html.RenderAction("GetDocument ...

When items are removed client-side, the Listbox becomes null

Given a Web Forms project inherited by me, I am relatively new to the field of Web development. The page in question features 2 listboxes: lstCaseLoad, containing "Caseloads" (ID numbers), and lstAssignedCaseLoad, filled with Caseloads chosen by the Form U ...

Learn the process of converting C# code to Kotlin with the incorporation of a Json library

Hello, I am new to Kotlin and apologize for my poor English. I am trying to convert the code snippet below to Kotlin. However, I am having trouble finding the equivalent of [JsonExtensiondata] in Kotlin. public class ProofAttribute { [JsonProperty(&q ...

mistake within the do while loop

public Login ClickGetStatus() { //IWebElement btnGetStatus = driver.FindElement(By.XPath("//*[contains(@id,'GetStatus')]")); do { buttonName_GetStatus[0] = "abc"; Thread.Sleep(3000); bool is_displayed = ...

Converting a web URL within a string to JSON format by utilizing DataContractJsonSerializer and including escape characters

Currently, in my C# project, I am utilizing the DataContractJsonSerializer to serialize a class containing a property that stores a web URL. public class Information { string Url{get; set;} } To save this data to disk, I use the following code snippet: ...

Issue with MVC HTML Helper DropDownListFor failing to submit the chosen value

I'm facing an issue with jQuery form serialize as it's not sending the value of the drop down list to the controller. The control is able to retrieve the ID and Name from the .cshtml file. HTML-code @using (Html.BeginForm("", "", FormMethod.Pos ...

Save the content of a string object into an array

I am currently implementing an array sorting functionality using the MVC approach. The array called "array" is used to store values provided at runtime. Within the view, there is a textbox and a button for user input of integer values. Upon clicking the bu ...

Executing a C# function from an HTML hyperlink

I am in the process of developing a website using ASP.NET C#. The site will feature a GridView with data that can be exported, such as to Excel or other formats. To handle the export functionality, I plan to utilize code from this resource. When a user c ...

Transforming the typical click search into an instantaneous search experience with the power of Partial

I am working on a form that, when the user clicks a button, will display search results based on the entered searchString. @using (Html.BeginForm("Index", "Search")) { <div id="search" class="input-group"> @Html.TextBox("searchString", n ...

What is the process of transforming an object into an array in C#?

jsonResult["filePath"] {[ "D\\test.pdf" ]} Is there a way to obtain the path of this file? I am having difficulty converting this object into an array. Are there any alternative methods to access this filePath? ...

Error message stating that compound class names are not allowed in Selenium Webdriver

I'm having trouble inputting a value into an "id class" and keep receiving an error message "Compound class names not allowed" Even after attempting the cssSelector method, I am still encountering Unable to locate element Would appreciate any help you c ...

transform the JSON string into a two-dimensional boolean array

I'm looking for a way to transform a JSON string into a 2D array in C#. Currently, I have code that retrieves the text/json from a web browser and saves it as a string. "BoolArray": [ [ true, true, false, ... ], [ true, tr ...

Selenium/c# facing issue with clicking Dynamics365 dropdown menu - getting "ElementNotVisibleException" error

Currently working on automating Dynamics365 CRM using Selenium/C#. I am able to successfully click and drop down the menu, however, I am facing issues finding and clicking on the "Submitted" option (line 2 of the code). The exception I am encountering is: ...

Passing a list of objects containing lists in MVC3

Is it possible for me to send an array of objects, each containing arrays, from JavaScript to a MVC action result method? Essentially, I have a KeyValuePair with keys as arrays of strings and I need to return a list of these KeyValuePairs. In my code, I ha ...

How to deserialize JSON with NewtonSoft when dealing with properties with the same name and arrays

Recently, I received a json result that looks like this: {"status":"1","message":"OK","result":{"status":"0"}} I am trying to extract the status value of 0. This is my code: public class GetTransactionStatus { [JsonProperty("result")] ...

Assign a background image to a master page utilized in subdirectories

In my website's root directory, I have a master page. Inside this root directory, there is a folder named Images which contains the background image for my master page. When I apply this master page to web pages located in the root directory, everything wo ...

Trigger modal following unsuccessful registration

I have a method in the controller for registering users. [HttpPost] public ActionResult Register(RegisterViewModel register) { if (this.IsCaptchaValid("Captcha is not valid")) { if (ModelState.IsValid) { ...

Dynamically generated pop-up modal based on verified user

Can anyone provide guidance on this issue? I am working on a login screen for two types of users: Suppliers and Admins. I need to implement a popup screen that appears only when a supplier logs in, prompting them to sign a declaration by clicking on a rad ...

Having difficulty interpreting an encrypted string retrieved from a Web Request using a StreamReader

I am trying to fetch a JSON string from a specific URL, but the string is encrypted and saved as a .txt file. I need to decrypt this string within my application. Below is the HttpWebRequest code I am using to retrieve the response string: public string ...

Currently struggling to retrieve data from an AJAX post request within a C# controller

I need assistance with sending data from JavaScript to a C# controller using AJAX. However, I am facing an issue where all the arguments in the Add method of my controller are showing up as null. Below is my AJAX code: function sendRequest(name, price, ab ...

Guidelines on configuring JsonSerializerOption on a request-specific basis

I have developed a .NET 7 web api with an endpoint that fetches user data. public class User { public Guid? Id { get; set; } public String? Name { get; set; } public Int32? Age { get; set; } public String? HairColor { get; set; } } When th ...

Transferring binary data from C# to Node.js for deserialization

I am facing a challenge where I have a byte array created in C# from an object type, which is then sent over the socket protocol to a Node.js app. However, I am unable to deserialize the data into a readable object. Can anyone suggest a way to decode this ...

tips for passing a string array to an actionresult

I've been struggling with a variable that is a string[] parameter. Despite my attempts to push values in the actionresult, I haven't been able to successfully match the string[] parameter. Here's what my ajax code looks like: var panels = []; $('i ...

Choosing an item from a dropdown menu in C# using Selenium in web assembly is proving to be ineffective

I am currently working on some automated tests using Selenium Web driver. I have been able to write a script that can locate the class, but I am facing difficulties in selecting one of the items from the drop down menu. Here is the script I have so far: ...

The Jquery ajax function fails to execute after upgrading the framework version from 3.5 to 4.0

After testing with alert, I am facing an issue where the ajax call is not working in my aspx.cs file when switching from .NET framework 3.5 to 4.0. The ajax function being used is: function GetCustomers(pageIndex) { $.ajax({ t ...

Selenium in C#: Timeout issue with SendKeys and Error thrown by JS Executor

Attempting to insert the large amount of data into the "Textarea1" control, I have tried two different methods. The first method successfully inserts the data but occasionally throws a timeout error, while the second method results in a JavaScript error. A ...

Receive JSON data with camel-case in a Web API 2.0 using a model in pascal-case style

My attempt to execute a PUT call on my Web API involves configuring the WebApiConfig.cs file to send data back to my Web project in camel case format. config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesCont ...

Triggering a button click to upload a file from within a grid view

I'm having trouble uploading a file when the "Fileupload" control inside gridview changes. I want to save the file content in DB as soon as it is uploaded by the user. I tried manually triggering the click event of the button control on the change of the f ...

Approaches to Json serialization and data storage

When it comes to web applications, Json is a commonly used format. I have chosen to set a field in the database to store Json strings as text. While some may argue that this is not the best way to design a database, my rationale is that the data's composit ...

The LINQ to Entities software is unable to identify the method 'Newtonsoft.Json.Linq.JToken get_Item(System.String)' method

Below is a working code snippet: string data = Encoding.UTF8.GetString(eventData.GetBytes()); JObject o = JObject.Parse(data); var disp = db.Dispositivos .Where(p => p.ClaveDispositivo == "UM5WOkRIFtS9dWbM5f1YM/ncpdrpSYrh3zND9Y/YHM4="); if(disp.T ...

Encountering a browser error when trying to access a C# method via AJAX: Javascript

I'm having trouble connecting to my Webservice. I keep getting an error 404, even though everything seems like it should be working fine. The issue started when I moved the code from my *.cshtml file into a separate .js file. The Javascript file is locate ...

The Ajax request fails to trigger the success function following the JsonResult response

Attempting to utilize Ajax to add a record to the database and retrieve data from JsonResult upon successful insertion leads to an error message: parseerror. Oddly enough, the record is successfully added to the DB. Below is the code for the post method: ...

Configuration files and dynamic link libraries included in the Electron software package

I'm trying to figure out how to package dlls and configuration files using electron-builder or electron-packager. Despite searching the documentation for both tools, I haven't found an example of where to place these files when packaging the appl ...

The Ajax Auto Complete function encounters an issue when attempting to assign a value to the TextBox

I have a Textbox that utilizes an Ajax Autocomplete function. The function is functioning correctly and retrieves values from the database, populating them in the TextBox as well. However, there is a button on the page that triggers a query, fetching som ...

Best practices for making an AJAX call to fetch information from a database

I have a database containing a single table. The table includes columns for Company and Time, among others, with Company and Time being crucial. Users can make appointments by filling out a form. Within the form, there are 2 <select> elements - one ...

The functionality of the onclick and onserverclick attributes seem to be malfunctioning when

I am in the process of creating a basic login screen using the code provided below: <form id="login"> <div class="formHeader"> <h1>Login</h1> </div> <div class="formDiv"> <input type="text" placeholder="Email" na ...

Learning how to utilize various types of buttons in C# and ASP.NET with this

I was following this tutorial: I like everything the same except I want to make the following change: <section> <a rel="external" href="#button" id="button">&#xF011;</a> <span></span> </section> ...

Check whether an element is currently in focus with Selenium WebDriver

It's surprising that there doesn't seem to be much information available online about testing for element focus using Selenium Webdriver. I'm interested in verifying that when a form is submitted without filling in a mandatory field, the focus shifts to t ...

Issue with Ajax-Enabled WCF Service (JSON) encountered during utilization with jquery .ajax()

Regrettably, the error condition is only triggered when calling .ajax(), and textStatus (the second parameter) merely displays "error". Despite thoroughly examining multiple examples and other inquiries on stackoverflow, I seem to be overlooking something ...

Combining an Editor and Dropdown Feature for a Single Attribute in Asp.Net MVC

How can I implement both an Editor and a Dropdown list for a single field? In the scenario where an agency is not already in the database, the user should be able to enter the agency name. Otherwise, the value should be selected from a dropdown list. I n ...

Storing Selenium WebElement in memory for extended periods to retrieve its details: A guide in C#

I am using Selenium and C# to monitor a website for any new items that may appear. The website contains a list of <div class="myClass"> elements displayed in a table format with multiple sub-divs. Periodically, I scan all the displayed divs to check ...

What is the best way to transmit data through a web socket connection effectively?

When it comes to sending data over a web socket connection, is there an optimal method? In my specific scenario, I am transmitting data from a C# application to a Python (Tornado) web server by sending a string with multiple elements separated by commas. I ...

The main view is invoked once more following the successful retrieval of a partial view via an Ajax request

My view is designed to display a list of orders stored in the database. The process is as follows: /// <summary> /// Displays the list of all the suppliers orders filled by now. /// </summary> /// <returns></returns> public ActionR ...