code-behind

How to get control value after Javascript refresh

拜拜、爱过 提交于 2019-12-14 03:18:32
问题 I have a page that has a popup modal window and the modal returns a value to the page and then refreshes it. I need to be able to get the value in the code-behind of the page when it is refreshed but the value of the text-box control that it is returned to is always "" after refresh. How can I get the value of the one I returned using JS? The code is added at a test at the moment as I try to get the value of the textbox which has contents before it is refreshed. protected void Page_Load

Add code to a style in WPF

别来无恙 提交于 2019-12-14 02:28:40
问题 I have several projects in which I have for exemple, textboxes that I would like to behave the same way always. For evertyhing like background to lenght, it's fine, but I also would like to add base event handler (in this case, the got focus event). Is this possible and if so how ? Thanks. Edit : here is an example : <Style x:Key="BaseComboBox" TargetType="ComboBox"> <Setter Property="FontSize" Value="12"></Setter> <Setter Property="Foreground" Value="Black"></Setter> <Setter Property=

asp.net passing values from JS/jquery to code behind c#

╄→尐↘猪︶ㄣ 提交于 2019-12-13 16:23:06
问题 I have tried "every" possible way of sending the screen.width vlaue from the JS script on the aspx page to the c# in the code behind and while I can see the screen.width being assigned correctly it never gets assigned to my hidden field value. <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <asp:HiddenField ID="hiddenfield" runat="server" /> <script type="text/javascript" language="javascript"> $(function(){ $('#hiddenfield').val(screen.width); }); </script>

Can';t work using html textbox to login

会有一股神秘感。 提交于 2019-12-13 14:29:47
问题 Because I am using html buttons and textbox to login, I must do the code behind in the javascript in the source code in order to do the code behind. Whether I login using the correct username and password which is Admin and 123 and click the login button, or I type in nothing and click the login button, it always redirects me to ResultDetails.aspx. That means login fail. Login will pass if it redirect me to Search.aspx. What's Wrong? Even if I change .Value to .Text, it is still the same

Event Handler Stops Working After Dispose

江枫思渺然 提交于 2019-12-13 05:24:25
问题 The three ImageButtons below are added to a panel (pBreakfast) in a page's codebehind: ImageButton ibSR = new ImageButton(); ibSR.ID = "ibStickyRoll"; ibSR.ImageUrl = "/images/Breakfast.gif"; ibSR.Click += new ImageClickEventHandler(ImageButton_Click); pBreakfast.Controls.Add(ibSR); ImageButton ibD = new ImageButton(); ibD.ID = "ibDoughnut"; ibD.ImageUrl = "/images/Breakfast.gif"; ibD.Click += new ImageClickEventHandler(ImageButton_Click); pBreakfast.Controls.Add(ibD); ibD.Dispose(); using

The file designer.cs is incorrectly nested in the Solution Explorer and cannot be moved

廉价感情. 提交于 2019-12-13 05:21:52
问题 I am using DotNetNuke 9.0.01. Here I created a module in Visual Studio and installed it in the DNN extensions. I didn't use the installation file but the one with the source code. Unfortunately now the file View.ascx.designer.cs is not below the View.ascx. It is outside the code-behind. This also leads to the problem that intellisense doesn't know the attributes and therefore I can't use them. This in turn leads to the fact that I cannot compile. So it's not just a display problem. I have

How do you call an onClick event from a MenuItem in ASP.NET?

☆樱花仙子☆ 提交于 2019-12-13 04:16:24
问题 How do you call an onclick event from MenuItem since there is no OnClick property for MenuItem in ASP.NET? Using NavigateUrl we can navaigate to a particular url but once I click on MenuItem it should trigger an event. 回答1: Menu has MenuItem.MenuItemClick event, you can use that to do whatever you wanted with onclick . 回答2: You can use the Menu.MenuItemClick event of the Menu that contains your menu item: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.menu.menuitemclick

How to set a RadComboBox that is using a data source to a selected value in codebehind

房东的猫 提交于 2019-12-13 04:14:37
问题 I have a RadComboBox that is bounded by a datasource. I set the datacource to select from a the database using a select query. Run I run the project, I get a complete list of items in the RadComboBox. I want to set the RadComboBox to a selected value, or index in the codebehind. So the RadComboBox will have a value in it once the page is load, instead of it being empty. I have tried to do this with the code like so: RadComboBoxItem item = RCB_PO_NUM.FindItemByText("2000"); item.Selected =

How to bind a Control.Property to a property in the code-behind?

霸气de小男生 提交于 2019-12-13 03:25:10
问题 I have a TextBox in my WPF window. I have a property in the code behind called Text as well. I want the text property to be bound to the Text property (i.e. when the value changes in the property the textbox value should also be updadated. Thanks 回答1: You have to set the DataContext of the TextBox control (or of any of its parents) to your window: myTextBox.DataContext = this; then in your XAML: <TextBox Text={Binding Text} x:Name="myTextBox"/> 来源: https://stackoverflow.com/questions/1734969

What is the preferred workaround when an .aspx file's code-behind file is missing?

拟墨画扇 提交于 2019-12-13 01:44:02
问题 In the source code for a VB ASP.NET website that I'm trying to get compiling, I've got a couple of " The file 'bla.aspx.vb' does not exist " errors; there is a corresponding .aspx file, but it's missing its companion .aspx.vb code-behind file. The error msg displays because of this in the .aspx file: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Bla.aspx.vb" Inherits="cms_ShowEscalatorRule" %> To just get the project compiling (this is just for running the project locally, the code