code-behind

Xamarin datatemplate with bindings in code behind not working

醉酒当歌 提交于 2019-12-01 13:32:28
问题 I have tried to make a page in my app where all controls are generated dynamically via C# code behind. I am using a Nuget Packages, DLToolkit, flowlist to create a flow list. I have already used this package in my project before using Xaml , and it fully works. However when I try to create a datatemplate in code behind, it just displays a blank control, however when hovering above this control, you can see there's actually items in it. My question is: How can I make a datatemplate with

Display image from a datatable in asp:image in code-behind

喜欢而已 提交于 2019-12-01 09:21:15
I have a datatable which is filled from the resultset of a 1 row select statement (via a stored procedure in SQL Server 2008) and it contains a Image typed column which I store images in. I have an asp:image control on an aspx page and i want to set the image to the corresponding field of that datatable but anything I do I can not. Please tell me how can I set the asp:image to image column of that datatable from the code behind . Try the Data URL scheme : <img src="<%# ReturnEncodedBase64UTF8(Eval("ColumnA")) %>" /> protected static string ReturnEncodedBase64UTF8(object rawImg) { string img =

How to get a 'codebehind' file for an ASP.NET-MVC View in RC1 to be created by default

邮差的信 提交于 2019-12-01 06:03:16
In RC1 the behavior of the template for creating a view changed. As explained by Scott Gu's post about the release candidate a newly created aspx view doesn't have a code-behind file by default anymore. Based on feedback we’ve changed view-templates to not have a code-behind file by default. This change helps reinforce the purpose of views in a MVC application (which are intended to be purely about rendering and to not contain any non-rendering related code), and for most people eliminates unused files in the project. The RC build now adds C# and VB syntax support for inheriting view templates

Reading dynamically generated HTML element value in codebehind in ASP.NET

╄→尐↘猪︶ㄣ 提交于 2019-12-01 04:38:11
I have an asp.net page where I have the below markup. Basically this markup is generated from codebehind by reading records from a table and looping through them. For each record in table, there will be a div block. Basically this form is to read/show settings for a user. The settings entries are stored in a table. <div id='divContainer' runat='server'> <div id='div1' runat='server'> <table> <tr> <th>Name</th> <td><input type='text' id='txtName1' value='something' /></td> </tr> </table> </div> <div id='div2' runat='server'> <table> <tr> <th>Domain name</th> <td><input type='text' id='txtName2'

MVVM: Is code-behind evil or just pragmatic?

回眸只為那壹抹淺笑 提交于 2019-12-01 04:27:32
问题 Imagine you want a Save & Close and a Cancel & Close button on your fancy WPF MVVM window? How would you go about it? MVVM dictates that you bind the button to an ICommand and inversion of control dictates that your View may know your ViewModel but not the other way around. Poking around the net I found a solution that has a ViewModel closing event to which the View subscribes to like this: private void OnLoaded(Object sender , RoutedEventArgs e) { IFilterViewModel viewModel =

How to get a 'codebehind' file for an ASP.NET-MVC View in RC1 to be created by default

瘦欲@ 提交于 2019-12-01 03:15:49
问题 In RC1 the behavior of the template for creating a view changed. As explained by Scott Gu's post about the release candidate a newly created aspx view doesn't have a code-behind file by default anymore. Based on feedback we’ve changed view-templates to not have a code-behind file by default. This change helps reinforce the purpose of views in a MVC application (which are intended to be purely about rendering and to not contain any non-rendering related code), and for most people eliminates

Access an HTML control on ASP Master Page from the code behind of a Content Page

旧巷老猫 提交于 2019-12-01 01:23:43
I have an ASP.NET / C# application in which the Master Page contain the main menu of my application and several content pages that depend of this master page. I would like to highlight the menu link of my master page corresponding to the current content page displayed. To do that, I already have a CSS class dedicated to this (called "selected") Thus, I was trying to access the Master Page link I want to highlight from the content page by using its ID and do something like that (in the content page) : HtmlLink currentMenu = (HtmlLink) Master.FindControl("idOfTheLinkToHighlight"); currentMenu

Finding the default style for a type in code behind

微笑、不失礼 提交于 2019-11-30 19:37:34
In WPF, you can create a Style that acts as the default for a control type in XAML: <Style TargetType="{x:Type local:MyControl}"> . . . </Style> Then, when WPF goes to display that control, it looks up that Style from the resources based on the its type. I want to do the equivalent of this in the code-behind of my program. How do I find that Style ? ZF. You can search for the style in the Application-level resources by using the control type as the key: Style defaultStyle = Application.Current.TryFindResource(typeof(MyControl)) as Style; object globalStyleDefinedByApp; Style globalStyle = new

How to set Table/TableRow/TabelCell width by percent in code behind in asp.net?

不问归期 提交于 2019-11-30 19:15:55
How do I set width with percent in code behind? The only option I can think of is taking the parent width and calculate by percent.i.e. TableRow.Width = Table.Width.Value * 25/100 (set table row with width equals to 25% of the table width). However, eventually, how do I set the table width in percent? Without the table width, the child controls cannot use its parent widths to calculate. Will this not work? Although I'm not entirely sure why you'd want a table row to be 25% of an overall table's width TableRow.Width = new Unit("25%") .Net wrappers for html components dose not include "width"

Disabling all but one child control in a WPF window

我是研究僧i 提交于 2019-11-30 18:07:43
I have a bunch of controls on my window. One of them is a refresh button that performs a cumbersome task on a background thread. When the user clicks the refresh button, I put the cursor in a wait (hourglass) status and disable the whole window -- Me.IsEnabled = False . I'd like to support cancellation of the refresh action by letting the user click a cancel button, but I can't facilitate this while the whole window is disabled. Is there a way to do this besides disabling each control (except for the cancel button) one by one and then re-enabling them one by one when the user clicks cancel?