codebehind

Jquery validation does not stop execution of "code behind" code of asp.net button

Hi, I have a asp.net button which has click event which basically adds data into datbase. I also have a radiobuttonlist(i.e Approve / Decline) and a textbox. If user selects decline, the textbox becomes visible. I want to run validation that when user clicks on submit button, if the decline is selected then the textbox can not blank. I ...

ASP.NET and IsNew on the page level

Never seen this before in ASP.NET development. I'm trying to refactor out 40 single-page ASP.NET pages to code-behind style. What does this code do? // Validate required parameters (if "new", then nothing is required) if (!this.IsNew()) { if (string.IsNullOrEmpty(_billId)) { responseErrorNo = 4; Utils.SendError(respErrNum);...

What is the ASP.NET equivalent to memcached in PHP?

Is there an equivalent in ASP.NET to memcached usage in PHP? Is there even a way I could use memcached from the VB code behind, or something like it? ...

Call a code behind function from javascript in aspx

I have a page where a javascript will be triggered when the user closes the browser tabs / browser window. Language is in c# thanks. im using window.onbeforeunload, something along the line like this: <script type="text/javascript"> window.onbeforeunload = myFunction; function myFunction() { //call my function here } the ...

Asp.net MVC Calling ActionLink in Codebehind

I am new to asp.net and MVC, so please go easy on me. :) I have successfully made a small MVC application. There is a database that contains a table named "Entry" and I have made Controllers for this. Also I have a view for Details and list. This works fin. My problem is in my index page. (not the view Index, but the frontpage). There ...

How do you modify a modal popup from ASP codebehind instead of letting it close?

I'm using SimpleModal to create a popup on an ASP.net application. The OK button calls a server-side function - and based on the resulta of that function I'd like to modify the popup (make some things visible, etc.) instead of letting it close. If that's too difficult, I'd like to open the popup again without the user having to re-clic...

Can MVVM Usercontrols have property defined in codebehind ?

Hi, I have a WPF user control ...which is in MVVM. The user control(which contains a listview) need data from the page (where it is included). I have to set a property to get this data input. Will this comply with MVVM...if not, what is the way for the same? ...

Set Validation Tooltip in CodeBehind instead of XAML

I would like to know how to translate the following code to codebehind instead of XAML: <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Styl...

Updating label using jquery and code behind

Hi, I have a label on a page and I'm updating the text property of the label (with a calculated value) when text is changed in a textbox. I'm updating the label like so: $myLabel.text("123"); The text is being displayed correctly on the screen butwhen I try to save the text value to an object in the code behind (When I press a butto...

Binding to XMLDataProvider in Code Behind

Hello, i have a problem moving a XMLDataprovider Binding with XPath from Xaml to code behind. Labels.xml <?xml version="1.0" encoding="utf-8" ?> <Labels> <btnOne Label="Button1"/> <btnTwo Label="Button2"/> </Labels> MainWindow.xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x...

How do I handle click events on multiple similar buttons in WPF?

I'm a C# beginner and am trying to implement a numeric pad in WPF. It consists of 10 similar buttons: <Button Content="0" Name="button0" Click="anyButtonClicked" /> <Button Content="1" Name="button1" Click="anyButtonClicked" /> <Button Content="2" Name="button2" Click="anyButtonClicked" /> ... <Button Content="9" Name="button9" Click="a...

Accidentally deleted the code behind for an Xaml file. How do I add the code behind again?

Instead of excluding it, by mistake, I deleted the .cs code behind file for an Xaml file. Now, I don't know how to add the code behind. This Window is empty with no UI controls on it. "View Code" is disabled and I can't see the Events (lightning bolt icon) anywhere for this xaml. Please help. ...

Binding Setter.Value from code

In XAML I can write something like this: <Setter Property="PropertyName" Value="{Binding ...}" /> How would I do this in code? I've constructed bindings in code before, but I can't seem to find any static ValueProperty object on the Setter class to pass to BindingOperations.SetBinding(). ...

Is there a way to prevent an ASP.Net webapp from clearing out page variables on VB side?

I have a webapp in ASP.Net with a VB codebehind. I need a List variable I have declared to persist as long as the person is on the page, but currently any time a control posts back to the code, everything is cleared out. I am completely new to ASP.net, so I have no idea if this is even possible. Can it be done with a Session variable?...

How can I get the x:Name of an object from code?

Given a reference to an object defined in XAML, is it possible to determine what (if any) x:Name the object has, or can I only do this by accessing the FrameworkElement.Name property (if the object is a FrameworkElement)? ...

How can we hide (invisible) some CodeBehind lines (for example a class) from other developers in a common project?

How can we hide (invisible) some CodeBehind lines (for example a class) from other developers in a common project? I asked this question because today we were working on email codes and we wanted to send an email to all of programmers emails therewith sending an Email to our common web site email. How can we hide our passwords from eac...

How can I change the background color of a gridview cell, based on a conditional statement?

Okay I clearly haven't fed google the right query or I would've found out by now. I'm hoping someone on this forum can help me. So I have a datatable that I'm adding rows to based on a datareader that's getting its info from an sql query executed over a database. So far, so good. Now, one of those columns is called 'analysis', and I nee...

ASP.NET Controls from different assembly

Hi, I've got some controls in my 'GeneralControls' assembly (classic DLL), those consists of .ascx file (and codebehind for them). I'm referencing that DLL, and using the controls as: <%@ Register Tagprefix="g" Assembly="GeneralControls" Namespace="GeneralControls.UI" %> <g:FooterControl ID="Footer" runat="server" /> but, FooterC...

Calling a jquery function from code behind in asp.net doesn't seem to work...

I am calling a jquery function after inserting a record to database... ScriptManager.RegisterClientScriptBlock(LbOk, typeof(LinkButton), "json", "topBar('Successfully Inserted');", true); I have included this in my master page for executing jquery function after a postback, <script type="text/javascript"...

What's with empty code-behinds?

I understand the benefit to unit testing of preferring the view-model over the code-behind. However, I cannot understand the obsession with achieving completely empty code-behinds. At compile time, the code behind and the XAML are combined, so they are actually the same thing. I, to, love using XAML due to its declarative nature which...