Questions tagged [code-behind]
Code-behind refers to code for your UI (Windows Forms, ASP.NET page, etc.) contained within a separate class file. This allows separation of the UI and the logic behind it.
1,930
questions
0
votes
1
answer
25
views
element defined in xaml "does not exist" in c# code behind
I´ve started to learn xamarin forms and now I'm already starting to apply animation to my Image. But I've got an error in my code.
Here's my code in xaml.cs:
using System;
using System.Collections....
0
votes
0
answers
56
views
How do I call an async dependency service from my xaml.cs code behind?
I am overriding the OnBackButtonPressed() event in my code-behind because I add some custom navigation behaviour.
My target is to call a function from my bluetooth classic dependency service (...
0
votes
0
answers
18
views
variable between 2 pages (aspx.cs)
I have a form page with a button
When i click the button different stuff happens
At the end im showing another page as popup
i want to show variables in the pop-up from the first page and when the pop-...
0
votes
1
answer
50
views
How to change the text of a textbox in asp.net from code-behind
I'm trying to change the text of a textbox to increase by 1 after I click a button.
When I use this,
txtcounter.Text = txtcounter.Text + 1
The value increase by 1 but, it changes back to its original ...
0
votes
2
answers
149
views
(ASP.NET) Changing an input at the start of Page_Load() and then retriving the input value after form submit gives the old value
I have a form that is supposed to have defalt values, which the user can decide to change in some fields. The inputs are set up like this:
<input type="text" id="username" ...
0
votes
1
answer
17
views
Opening a popup by calling Javascript from CodeBehind
I am trying to open a popup window by calling a JavaScript function in CodeBehind (vb.net) on a button click event.
The idea is that I click the button, the button click event does a bunch of stuff, ...
0
votes
1
answer
29
views
C# User Control (MVVM) surface a property in MV
I feel though i may be missing somethig here, or its not doable (which i find hard to belive).
I have a UserControl thats using MVVM archtitecture.
The UserControl looks like this.
public partial ...
0
votes
1
answer
16
views
Complie error CS0103 after converting website to webapplication
I have an old website project that I am attempting to convert to a web application. After doing the conversion, I am receiving CS0103 errors. Here is the web page code:
<%@ Page Language="C#&...
0
votes
1
answer
23
views
Is there a way to assign a dynamic resource to a dependency property in code
I have a SolidColorBrush defined in a Resource Dictionary as follows:
<Color x:Key="ColorGray100">#F5F6F7</Color>
<SolidColorBrush x:Key="BrushGray100" Color=&...
1
vote
0
answers
39
views
ASP .net Datagrid Dynamic (OnRowDataBound) find all cell by label display diverentz by collor
I have a special thing to solve and can find a solution.
The Datagrid is bound to SQL query and has dynamic inner Join that is detectable all-time changing. The user can select any imported Data to ...
0
votes
1
answer
31
views
Visual Studio message: The document item has no code-behind file. (Building GUI for Powershell)
In Visual Studio, I created a new PowerShell Script Project to build a GUI for a script. Its something simple for now to moreso understand the concept of how this would work.
In the GUI I want to ...
0
votes
0
answers
42
views
asp.net Catch onchange event on myfileupload to execute code behind subroutine
I want to catch when the user select a file from the myuploadfile control.
so:
user click Browse
browse window opens
user select the file and hit Open button
here I want to execute some code behind
I ...
0
votes
1
answer
43
views
Programmatically binding ComboBox
The task is a DataGrid with an unknown number of columns and rows. One column contains textbox, checkbox, imagebutton "Image-ComboBox" and "Text-Combobox" (both non-editable). ...
0
votes
1
answer
67
views
Why does the crystal reports engine appear to behave differently when used in a background task started using QueueBackgroundWorkItem?
In a web application I have code to generate a PDF file using crystal reports and both the ReportDocument.ExportToDisk and ReportDocument.ExportToStream methods. I am using the 64bit crystal runtime ...
0
votes
1
answer
77
views
Binding List<List<object>> to DataGrid columns in code-behind
I have a problem binding List<List> to DataGrid columns in code-behind.
Here is my list of lists:
private List<List<object>> matrix = new List<List<object>>()
{
...
0
votes
0
answers
38
views
Signature Pad Using C# Code Behind Will Not Allow Signature Insertion
@szimek I am trying to implement your Signature Pad in a C# Web Forms application. The signature pad displays and the Clear button is clickable, but the canvas won't open up to allow entry of the ...
0
votes
0
answers
45
views
C# call method once and append to existing values before before binding to gridview
my question is how can i call the method from dal layer to generate sas token only once and save the value in the code behind file and no matter how many different pages it hits after that when it ...
0
votes
0
answers
79
views
WPF Expander usage inside DataGrid with code behind
I am trying to understand logic behind XAML in Expander control inside DataGrid. First I created this code in XAML inside the DataGrid and it works fine.
<DataGrid.GroupStyle>
...
0
votes
1
answer
176
views
Conditional text in Xamarin Forms
How do I conditionally render a particular text in Xamarin Forms 5?
For example, I get some data from my API backend for a vendor and there may be an address in the database for this vendor or not.
If ...
0
votes
1
answer
69
views
With a NavigationView control, how can I navigate from the code behind?
is it possible to navigate from code-behind in a NavigationView?
If I am one one page in the NavigationView's frame, and I want to leave that page and display another valid page, is this possible. My ...
0
votes
1
answer
95
views
C# WinUI 3 Get CS0053 error Inconsistent accessibility: property type 'INavigation' is less accessible than property 'App.Navigation'
Attempting to implement NavigationView navigation via code-behind using this solution I found:
https://xamlbrewer.wordpress.com/2021/07/06/navigating-in-a-winui-3-desktop-application/
I don't know ...
1
vote
0
answers
56
views
Which class name to use for code-behind file for index.razor in blazor?
When I split up a razor file into .razor and .razor.cs, I usually
1.) name the page in the .razor like e.g.
@page "/pagecreateuser"
and
2.) in the .razor.cs file, I name the class e.g.
...
0
votes
0
answers
16
views
C# WinUI3 - I need help understanding the operator '=>' in the context of the statement: 'Then we exposed the implementation via the App instance' [duplicate]
I am trying to navigate via code-behind in my WinUI3 desktop application. I have found this article that explains how to do it. https://xamlbrewer.wordpress.com/2021/07/06/navigating-in-a-winui-3-...
1
vote
1
answer
144
views
How to avoid multiple ifelse statements when validating user input? [Web Forms]
I have a very basic sign up page that has textbox fields like 'email','password','username'.
Although I have already used client-side validators (such as asp:RegularExpressionValidator) I also want to ...
-1
votes
1
answer
72
views
What is the code-behind equivalence of XAML <DataGrid Name="myDataGrid"/>?
Can I add WPF items programmatically without any manual interference with XAML? Please give me a hand.
0
votes
0
answers
58
views
<%%> onserverclick ignores server method
I rendered an <a> in HTML from code behind and from HTML page. however, from HTML side is works properly and from the server side, it doesn't recognize the method!
id = Try21 is from HTML side.
...
0
votes
0
answers
87
views
WPF) Notify ViewModel that property is changed in code behind
I have a user control that contains a text box. I'm using the built in events "TextChanged" and "LostFocus" in the code behind. Here i check if input is valid and updates an enum ...
0
votes
0
answers
147
views
WPF bind as a command parameter the value of a local variable in code-behind
I am dynamically creating buttons as the program progresses. Their count is changing.
I also bind a command for every button I create.
Is there any way to pass a local variable as a parameter to the ...
0
votes
1
answer
43
views
How to set Datatemplate binding based on object type from code?
Don't ask why, but I have to create a WPF Listview in the business logic part of the code (the reason is I'm dealing with legacy code, thats why.)
Anyway, so far everything works, however, I want to ...
0
votes
2
answers
54
views
Setting the value of an input through javascript
What I'm trying to do is to change a behind-the-code C# veriable's value through javascript. My code:
HTML & JS -
function SetPostbackValues() {
document.getElementById("hiddenControl")....
0
votes
0
answers
100
views
How to make ColorAnimationUsingKeyFrames on own control's Background work from code-behind?
I'm trying to achieve a dynamic, keyframes-based color animation of my own custom ToggleButton's Background property (WPF custom control inheriting a ToggleButton). I need the animation to have its ...
0
votes
0
answers
216
views
How to run events in global.asax.cs
I use Visual Studio 2019 to create a new webforms project. I write a Session_Start event in the Global.asax.cs, but it never fires!
Here is some code - Global.asax
<%@ Application CodeBehind="...
1
vote
2
answers
69
views
Cross compatible differences xamarin / C#
hope you can help!
Wondering how I can change code based on device version?
For example I have skia sharp code with a size integer set as below:
int size = Math.Min(180, 180);
On ios 13 this looks ...
0
votes
0
answers
31
views
VB.NET WPF Style Changes on Flow Document Combo Boxes Generate Exceptions That Trigger Successful Operation?
The following code formats the ComboBox background color in a WPF Flow Document.
Try
objHold = New Object
objHold = objCombo.Template.FindName("PART_EditableTextBox", objCombo)
...
0
votes
2
answers
74
views
I have an updated div, but my code-behind behave as it has never changed
I have a div object (riddleIdHere), and js code that during the running inserts a number into this div. I want my C# code-behind to use this number, but the code-behind gives me an empty string like I ...
0
votes
0
answers
20
views
Close window from codebehind after server-sided action
I tried several ways to fulfill the action:
Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
saveLestijden()
'Response.Write(" { window.close(); }")
'Page....
2
votes
1
answer
112
views
Access a related table in EF Core
I am trying to access a related table to display a column in my View.
I believe it is something quite fundamental I am not understanding but for the life of me can't solve it.
Simplified problem is, I ...
0
votes
0
answers
32
views
(Code behind) How to bind column chart with multiple series with WPFtoolkit?
I have list with with date, error_type and error_count columns, and I am trying to make column graph that displays error_count by date and it is working with one error_type (which you select), but ...
1
vote
4
answers
138
views
Dynamically change :after pseudo background-color
I am creating buttons within a repeater like this (simplyfied):
<asp:Repeater runat="server" OnItemDataBound="Repeater_Buttons_ItemDataBound">
<ItemTemplate>...
1
vote
0
answers
132
views
VS2022 CS8785 'CodeBehindGenerator' failed to generate MauiXaml
I work on a MAUI project on Visual Studio 2022 preview 3.
At compile time, I get the following warning:
CS8785 'CodeBehindGenerator' failed to generate MauiXaml
Then the code behind is not generated,...
0
votes
1
answer
82
views
ASPX project where do I find the logic behind the front end code
Hello I'm fairly new to developing in ASPX. I'm having a little trouble understanding where the data/logic is coming in from. Here is my code:
<%@ Page Title="" Language="C#" ...
-1
votes
1
answer
136
views
C# WPF XAML Mouse(Down) events not working anymore as of .NET 5(C#9)
Screen shot of the issue I'm running into after going to .NET 5 (C# 9)
I'm trying to figure out how they want us to implement this simple code now.
It says its an error but it still builds the project....
0
votes
0
answers
22
views
[C#]Printing many DataGrids in one page
Is there a way in C# to print e.g. 2 DataGrids and one Listbox in one page?
My customer asks me for such a printout, but I can't cope with it.
My 2-datagrids and 1-listbox
1
vote
1
answer
100
views
The name 'InitializeComponent' doesn't exist in the current context
I know that this error has many answers, but they are all some system errors or smth like that. I just created this app and it worked fine. Then I added a view-model to handle my navigation between ...
0
votes
0
answers
83
views
how can datetime-local have min value?
i have asp textbox like that:
<asp:TextBox ID="TextBoxExitTime" TextMode="DateTimeLocal" runat="server"></asp:TextBox>
i want that all of the dates (and ...
-1
votes
1
answer
43
views
vb.net Access a Dim with a string while enumerating a datatable
I am trying to update variable while I loop through a datatable
I use Findcontrol if I want to update a label but how do I that for a Dim?
Dim test1 As String = ""
Dim test2 As ...
1
vote
1
answer
39
views
Instantiating multiple view and passing data to each one
I have a prism app where I am instantiating multiple views in the code-behind of a parent view based on a property in the viewmodel
public I2CNavigatorView()
{
InitializeComponent();
...
0
votes
0
answers
31
views
Is it ok to have multiple code-behinds in Blazor?
I have a page that contains a large number of hierarchical grids. Currently using ADO.NET for data access so it can take up a lot of lines and be a little confusing when looking for things. I ...
0
votes
1
answer
221
views
Xamarin Forms Animation MVVM way
I want to make an animation that gets fired when a frame is clicked. I already have a command that's bound on the GestureRecognizers but that's part of my ViewModel and putting view code inside the ...
0
votes
0
answers
36
views
Detect if a child control has a viewmodel
I have a Parent View that contains a ContentControl with the following declaration:
<ContentControl x:Name="AppView" Content="{Binding ApplicationView }"/>
where ...