codebehind

Referencing a custom obj, declared as a static res in xaml, is null. Why?

I have a small Silverlight 3 test application. This is an exercise in learning Silverlight, XAML, binding, etc. I have a small test class (Test), which has three properties; Val1, Val2, and Sum. I have declared a resource in the XAML as follows: <UserControl.Resources> <app:Test x:Name="xamlTestObj"></app:Test> </UserControl.Reso...

ASP.NET - Passing arguments to the server on button click

Hi I have a ASP.NET web page which contains a table of check boxes and a button. I need to find the IDs of all the check boxes which are checked when the button click happens. Once the list of IDs are collected, it needs to be passed on to the server. I am able to do it using jQuery and PageMethods. How can I achieve this in the button...

How do I do an http post to code behind in asp.net webforms?

Hi, How can I call a method in the code behind from a jQuery post in asp.net webforms? In MVC it's simple, I just do this: $.post("/MyController/MyMethod", { data: somedata; }, function(result) { alert(result); }); but I can't figure how what to put for the first parameter if I wanted to call a method in the code behind in webforms....

How to access ItemsCount on a Group Item within WPF ListView in code?

I have XAML code with a grouped ListView that looks like the following: <ListView ItemsSource="{Binding}" Name="ContactList"> <ListView.ItemTemplate> <DataTemplate> <controls:ContactItemControl /> </DataTemplate> </ListView.ItemTemplate> <ListView.Gr...

page not loading in asp.net while debugging

i have a small 2 aspx page vb.net application. its has main.aspx with main.aspx.vb in back. first line on aspx reads - <%@ Page Language="VB" AutoEventWireup="false" codebehind="main.aspx.vb" Inherits="a1_main" %> first lines of main.aspx.vb read - Partial Public Class a1_main Inherits System.Web.UI....

Conditional popup box in vb.net & asp.net

Hi Everyone, I'm working on a piece of code at the moment that allows the user to enter values into fields. Once the user clicks on the 'save' button I am checking those fields against certain conditions (essentially calling a bunch of stored procedures to assess the values). If any of these 'rules' are met, I need to generate a popup t...

Accessing a resource via codebehind in WPF

I have a custom collection defined in my window resources as follows (in a Sketchflow app so the window is actually a UserControl): <UserControl.Resources> <ds:MyCollection x:Key="myKey" x:Name="myName" /> </UserControl.Resources> I want to be able to refer to this collection in the codebehind, which I expected would be by the x:N...

Implementing javascript in c# code behind

Morning all. I have the following javascript in my code in front <script type="text/javascript" src="~/VDSReporting/jquery.js"></script> <script type="text/javascript"> function ShowImage() { document.getElementById('tbxProdAC') .style.backgroundImage = 'url(/images/vds/progress.gif)'; document.getEle...

Microsoft JScript runtime error: Object expected

Hello all I have honestly tried several different avenues from google on this erro but I am hitting my head against a brick wall. I have this bit of jquery in my code behind: tbxProdAC.Attributes.Add("onclick", "$('radProdAC.ClientID').attr('checked', true); $('ddlBuyer.ClientID').val('--Choose Buyer--'); $('ddlSub.ClientID').val('--C...

WPF: Referencing app-wide resources in code-behind

I have made my own custom converter which given a string returns a Brush. Now I'm able to return constant brushes such as Brushes.Red etc., but I really want to use my own colors which I have defined in an application-wide resource. How do I reference application-wide resources from my own custom converter class? I'd use FindResource bu...

Ignore requiredvalidator in logout

Afternoon all. Here's an easy one for you that I can't figure out. I have a requiredfield validator that is doing its job too well! Upon the lnkLogOut, the user should be logged out but the requiredfield validator is preventing this. protected void lnkLogOut_Click(object sender, EventArgs e) { Session.Abandon(); ...

Is there a better way to access controls in an ITemplate than FindControl()?

When a control is added to an UpdatePanel, it can still be accessed from the code behind of the containing page. How is this achieved? Can custom control developers do the same? In other words, if I develop a template control using the ITemplate Interface, is there a way to wire it up (like the UpdatePanel seems to) so that any control...

Redirect to another page using Post method from Code behind

Hello, I want to implement a Payment service.I will create some values in code behind and then by using post method I have to post this values to Payment gateway and user must redirect to that page. I can't Use form action becuase I have to create some values and save some thing in db in code behind. how can I implement this? If I can...

ASP.NET Dropdown List in Codebehind vs in ASPX page

I am generating a dropdown list in codebehind and cannot get the selectedindexchanged event to fire automatically. It works fine when put directly into the ASPX page, but I need it to be in the codebehind. This doesn't work - var deptList = new DropDownList { ...

How do I make a reflection effect in WPF ? (from code)

hi guys, I need to have some mirror objects in WPF. I have a Canvas with some content, and I need 50 visual clones, and if I modify something on the source, it should be updated in these clones. I know it is easy to do in XAML by binding the Visual of a VisualBrush to the element, but can's seem to do this from code. Can anyone help ...

How to achieve clean code-behind files?

Working with WPF it is good practice to keep your xaml.cs code behind files small and clean. The MVVM pattern helps achieving this goal through Data Bindings and Command Bindings where any business logic is handled in the ViewModel classes. I am using the principles of the MVVM pattern and my code-behind files are rather nice and clean...

Updating a class in an ASP.NET website.

I have a certain class in VB in my App_Code folder, I can't deploy it directly to the website because I have no permission to the FTP, and I was asked to change a certain VB.net class and send it so someone would replace it in the FTP folder. What happens is: there is no App_Code folder in the FTP folder. and the class generates NO DLL ...

WPF: How do I get a reference to a styled window control in code behind?

I have a window defined with a style: <Window x:Class="winBorderless" x:Name="winBorderless" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Local="clr-namespace:WindowStyle" Style="{StaticResource Window_Cartesia}" ...

Change border properties of ASCX from code-behind?

Hi I am building a library of asp.net user controls which I am deriving from a custom UserControlBase class which further derives from actual UserControl class. Hierarchy looks like this : ASCX -> UserControlBase : UserControl I have this requirement to put a border around all the ASCX's. So, I thought if I can modify UserControlBase ...

From asp.net code behind (aspx.cs) on the server how can I determine if Silverlight is installed on the client?

IIS 6.0 hosting ASP.NET 3.5. From the Visual Studio 2008 aspx code behind (aspx.cs) running on the server I need to determine if Silverlight is installed on the client and if so which version. I know from Java on the client this can be done. That is not what I need. I know I can put in a control that will render if Silverlight ...