code-behind

Adding css class through aspx code behind

I am using aspx. If I have HTML as follows: <div id="classMe"></div> I am hoping to dynamically add a css class through the code behind file, ie on Page_Load. Is it possible? Thanks coders. ...

VS2008 Keyboard shortcut open Code in front

This is probably a total newb question but does anyone know how to make the 'F7' keyboard shortcut in VS2008 open the code-in-front page in source view rather than design view? Thanks. ...

Show CreateUserWizard's error message label

Hi, I've got a CreateUserWizard control and am performing server-side validation. Is there a way to force the CUW's error message to display from the code-behind? At the moment, if the user enters a duplicate name, the controls DuplicateUserNameErrorMessage property is displayed. However, if the user has turned javascript off, or sen...

No code-behind fields for server controls in ASP.NET design in Web App

I created a New Web Site in Visual Studio 2008, added a page with a control on it: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <body> <form runat="server"> <div> <asp:Label runat="server" ID="...

Obscured URL in ASP.Net Webforms

Hi, I am working on a ASP.Net web forms application which I inherited from a programmer who has already left the company a few months ago. The application is deployed in our intranet servers and user go the application via the url: http://TestApp/App1/(12345abcde)/login.aspx When I checked the IIS Server, the application's folder i...

Pass parameter as text to JavaScript function from .NET code-behind

Basically, I have a gridview that is opened in a new window from the parent window. It has a bunch of records with a view button to view the details of each record (which stays in the same newly opened window). I have a calendar in the parent window that accepts a Date querystring parameter to set the current date on the calendar at page...

Setting an asptextbox to read only from the code behind

I need to change the readonly property of a asptextbox from the code behind based on certain conditions. I know how to run a function when the page loads, but I don't know how to reference the form fields to change the readonly property. Can anyone point me in the right direction? Thanks in advance, Anthony ...

ASMX Web Service online works when all of the code is in one file without code-behind

I have an ASMX Web Service that has its code entirely in a code-behind file, so that the entire contents of the .asmx file is: <%@ WebService Language="C#" CodeBehind="~/App_Code/AddressValidation.cs" Class="AddressValidation" %> On my test machine (Windows XP with IIS 5), I set up a virtual directory just for this ASP.NET 2.0 solutio...

WPF/MVVM: Refactoring Code-Behind to make it ready for MVVM binding

Hello, I have this code in my code-behind file of my View: private string GetSelectedSchoolclassCode() { return ((SchoolclassCode)cboSchooclassCodeList.SelectedItem).SchoolclassCodeName; } private void dgTimeTable_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var columnNumber = dg...

Populate TextBox From Public Property From Code-Behind

I am trying to use a property from the code-behind to populate a textbox instead of using in the code-behind textbox.text=. I am using vb.net. Here is the code for the aspx page: <asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="server"> <asp:TextBox runat="server" ID="roleTextBox" Text='<%# CurrentRo...

Business Layer/Code-Behind Performance Question

I was wondering if anyone knew if there was a performance boost of any kind in C#/ASP.NET due to moving database calls from the code-behind to the underlying business logic class library. My understanding is that the class library is compiled, whereas the code-behind is interpreted. ...

What's the difference between SetFocus() and Focus() in ASP.NET?

I can use both in the code behind: SetFocus() - "Sets the browser focus to the specified control." Focus() - "Sets input focus to a control." In practice, what's the difference? Thanks! ...

Cannot access my UI controls in C# code. What's wrong?

I cannot access my UI controls on my ASP.Net website. When I create a brand new form and drag a control on it, I can use C# to change the properties of the control easily, like one would expect. But when I try to do the same on another page, I cannot access any control whether I drag a new control on the page or not. It seems the code...

utf-8 charcter problem in code behind

Hi there, I have a web site and it has some words with Turkish characters (ü,ş,ö,ç). There is no problem while is viewing. But when i want to use that words in code behind for example CheckBoxList.SelectedItem.Text, they are looking as html codes. For example; a label's text value is 'EYLÜL'. but when i looking that label's text value ...

android show context menu from code behind

Hi all, This might be a simple question, but i've been looking around and can't find the answer, well, as my title said, is there any code to show the context menu on the android from a code, instead press the menu button? eg. when i touch the screen then it'll call the context menu? Regards, AnD ...

Windows form/WPF too large, how can i split it up?

Hello people, I'm about to create WPF application. So far at uni the only way we have ever done GUIs is to have one main window with one code-behind file for handling its button clicks etc.. My issue is that as the application grows, the GUI grows, and the size of the code behind file can get really out of hand! I have identified abo...

Calling javascript from Codebehind

I have read many different resources but am still not sure if this is possible without using AJAX. I have a javascript function that loads a div into a modal and says "Loading Please Wait" I have named this funciton loadingModal() function loadingModal(url) { loadModal(...) } What I need to do is only trigger this after I have ...

WPF XAML code-behind management

Hello there... I have wandered into a WPF application project and have made some good progress, but one thing I am finding is that the code-behind page is now getting longer and longer... since there is only one XAML page to the whole application, the code-behind page that really just takes care of the event handlers and programmatically...

How to use Dataset desgner and Data Sources windows with WPF and XAML in vb.net 2008?

More moans about WPF: As it seems generally likely that MS are going to get rid of Windows Forms (sooner or later), and I am informed by the same organisation that WPF is 'cool', just exactly how can I use the wonderful graphical data toolset in vb.net 2008? I understand the basic concepts of creating table adapters and multiple queries...

Databinding to CLR property in code-behind

Binding to a Dependency Property is easy in code-behind. You just create a new System.Windows.Data.Binding object, and then call the target dependency object's SetBinding method. But how do you do this when the property which we're binding is a CLR property and you can't provide a DependencyProperty argument to SetBinding? EDIT: The ob...