codebehind

ModalPopup CodeBehind Function Wait For User Response

I have set up a function which returns an enum of the button that the user clicked in the ModalPopup. I have a variable of type enum to store which button the user clicks in the button click event. In this function, I call the ModalPopupExtender's Show() method. My problem is, the function finishes out and returns the default enum (wh...

How to assign a dynamic resource style in code?

I want to produce in code the equivalent of this in XAML: <TextBlock Text="Title:" Width="{Binding FormLabelColumnWidth}" Style="{DynamicResource FormLabelStyle}"/> I can do the text and the width, but how do I assign the dynamic resource to the style: TextBlock tb = new TextBlock(); tb.Text = "Title:"; tb.Wid...

HyperLink with NavigateUrl with Eval(). Where is a mistake?

First I was changing HyperLink.NavigateUrl in code-behind on Page_Load(). But after I decided to do it in design using Eval() method. <asp:HyperLink runat="server" NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Eval("type"), Eval("id")) %>' Text="Refuse" /> or <asp:HyperLink ID="urlRefuse" runat="server" N...

ASP.NET: Appending to HTTP response

I have a Page.aspx. I would like to inject a <script> tag into the response stream of Page.aspx, after it has finished writing its output. How could I do this form within the codebehind of Page? If I do this: protected void Page_Load(object sender, EventArgs e) { this.ClientScript.RegisterClientScriptInclude ...

Scroll to top of page after async post back

So I need to scroll to the top of the page after an async post back in an asp.net update panel. The code I used was this: Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestEventHandler); function EndRequestEventHandler(sender, args) { scrollTo(0,0); } However, I only want this to be run when I click on a cert...

asp.net programmatically add a span tag? Not Label control

How can I add a span tag from a code behind? Is there an equiv HtmlControl? I am currently doing it this way. I am building out rows to a table in an Itemplate implementation. var headerCell = new TableHeaderCell { Width = Unit.Percentage(16)}; var span = new LiteralControl("<span class='nonExpense'>From<br/>Date</span>"); headerCell.Co...

.aspx get data from. cs files?

Is databind, bind or eval... only way of getting data form code behind (server side) in ASP.NET ...

XAML without the .xaml.cs code behind files.

I'm using WPF with the Model-View-ViewModel pattern. Thus, my code behind files (.xaml.cs) are all empty, except for the constructor with a call to InitializeComponent. Thus, for every .xaml file I have a matching, useless, .xaml.cs file. I swear I read somewhere that if the code behind file is empty except for the constructor, there ...

Cannot see named Silverlight control in code

In my first few hours with Silverlight 3, as an avid WPF user, I am greatly disappointed at the many things it doesn't support. This seems like an odd issue to me and it's so generic that I cannot find anything online about it. I have the following XAML: <controls:TabControl x:Name="workspacesTabControl" Grid.Row="1" Background="Antiqu...

How can I refresh a custom wpf user control from code behind?

I have this custom wpf user control: ShowCustomer.xaml: <UserControl x:Class="TestControlUpdate2343.Controls.ShowCustomer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <Grid> <TextBlock Text="{Binding Message}"/> </Grid> </UserContro...

Tooltip in gridview

Hello all...complete novice at work (who is also ill and feeling particularly thick) I have the following code that gives me a generic "tool tip text" for each heading in a gridview....great. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.Header) { ...

Does anyone know of a XAML-to-CodeBehind converter?

It would be nice to have a tool in which you could copy and paste chunks of XAML such as this: <StackPanel Margin="10"> <TextBlock Text="Title"/> </StackPanel> And the tool would output the equivalent code behind such as this: StackPanel sp = new StackPanel(); sp.Margin = new Thickness(10); TextBlock tb = new TextBlock(); tb.Tex...

Jump to Anchor from CodeBehind without repost

Is there a way to append an anchor (test.aspx#23432) in the codebehind to the end of my current location in my address bar without using Response.Redirect()? ...

where is the other partial class definition of my default.aspx.cs ?

I built an empty website on VS 2010. Using the toolbox I put a DataGridView on my default.aspx. Then I configured the sql query that fills it from the DataSource. I wanted to see the ADO code that is done under the covers. But all there is the default.aspx file, and the default.aspx.cs: public partial class _Default : System.Web.UI.Pag...

ASP.NET: Getting ASPX filename

By convention, all my web site's .aspx files also have corresponding .css files at the same path. So, for example, Default.aspx has a file Default.css in the same directory. I wrote an extension method to add CSS tags to the headers of Page objects, and use it like this on Page_Load: this.AddCssFileRange(new[] { "Default.css", ...

ASP.NET Controls are not coming in codebehind intellisense

I am having an aspx page where i have added one asp.net text box control with ID and RUNAT attribute. But In codehehind i am not seeing this control's name in the intellisense. My page directive in aspx is as follows <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyProject_UI._Default" %> I Am us...

Access control on parent from IFRAME (RadWindow)

Need a "server-side" solution. Is there any way to access a control (Hidden HTML Field) from an IFRAME (RadWindow) that is on the parent page? Before I launch the IFRAME (RadWindow), I write the URL I am opening to a hidden HTML field on the parent page. The point is so I can access that value from within the IFRAME if I wanted to "go...

WPF - Change a style in code behind

I have a list box that displays the results of a TFS Query. I want to change the style of the ListBoxItem in the code behind to have the columns that are included in the query results. The style for the ListBoxItem is defined in my Windows.Resoruces Section. I have tried this: public T GetQueryResultsElement<T>(string name) where T :...

WPF binding in codebehind fails for transformations

Displaying a rectangle and binding Width, Height, Angle to a view model class works as I expect in XAML <Rectangle RenderTransformOrigin="0.5,0.5" Fill="Black" Width="{Binding Path=Width, Mode=TwoWay}" Height="{Binding Path=Height, Mode=TwoWay}"> <Rectangle.RenderTransform> <RotateTransform Angle="{Binding Path=Angle, ...

How can I two-way bind a TextBox to a code-behind property in ASP.NET?

I cannot get any new entries in the textbox:txtMyString to set to the property MyString. What am I missing here? <asp:TextBox ID="txtMyString" Text='<%# MyString %>' runat="server" /> private string myString; protected string MyString { get { return myString; } set { myString = value; } } protected void Page_Load(object sender, EventA...