webforms

HttpApplication.Start event does not exist

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-05 08:36:12
问题 I looked for an answer to this for quite sometime now but didn't find any. I will refer to Application start as a stage. Most of the documentations out there talk about the Global.asax file and the Application_Start method which is invoked only once when the first request reaches the Application, even if this behaviour is similar to subscribing to an event it's technicaly not an event. While lifecycle events such as BeginRequest, AuthenticateRequest and so on are accessible through the

How to get System.Speech on windows azure websites?

北慕城南 提交于 2020-01-05 04:14:14
问题 I have incorporated text to speech in an asp.net webforms application which works fine when running locally. When I deploy to azure websites however it looks like a null reference is happening dealing with System.Speech. I have tried to publish the webforms app to azure with the "Copy Local" as true on System.Speech .dll however the issue still persists. Is there anything I am missing to get System.Speech to work on azure websites? I have researched and found posts from a while back saying it

ASP.NET Custom Control Adapter not firing

痴心易碎 提交于 2020-01-05 03:57:09
问题 I am trying to write a simple ControlAdapter below is a very simplified case, but I still can't seem to get it to work. In my simplified case I just want to write something out before my control is rendered. I defined my control adapter as such: using System.Web.UI; using System.Web.UI.WebControls.Adapters; namespace Test.Web.Common.Controls.ControlAdapters { public class RadioBtnStyleAdapter : WebControlAdapter { protected override void BeginRender(HtmlTextWriter writer) { writer.WriteLine("

C# dropdown selected item null when list of strings/objects bound to the Data source

北城余情 提交于 2020-01-05 03:56:05
问题 I am trying to bind a List of string to a Dropdown. On frontend, I am able to see the list of dropdown correctly but when I select a value and click on search, it throws a null reference exception because it seems like it is read only. This is what I tried: <asp:DropDownList runat="server" ID="ddl" AppendDataBoundItems="True"> <asp:ListItem Value="">Please Select</asp:ListItem></asp:DropDownList> Code behind: List<string> items = helper.GetData(); //A method that simply returns a list of

Is it possible to initialize a Control's List<T> property in markup?

一世执手 提交于 2020-01-05 03:35:56
问题 Let's say we have the following: public enum RenderBehaviors { A, B, C, } public class MyControl : Control { public List<RenderBehaviors> Behaviors { get; set; } protected override void Render(HtmlTextWriter writer) { // output different markup based on behaviors that are set } } Is it possible to initialize the Behaviors property in the ASPX/ASCX markup? i.e.: <ns:MyControl runat="server" ID="ctl1" Behaviors="A,B,C" /> Subclassing is not an option in this case (the actual intent of the

Using jqGrid in ASP.NET WebForms

拟墨画扇 提交于 2020-01-05 03:24:08
问题 I've implemented and used a pretty functional grid through this tutorial for MVC: http://www.codeproject.com/KB/aspnet/AspNetMVCandJqGrid.aspx I was wondering how to migrate this to ASP.NET WebForms, for another project I want to use jqGrid on, but is written in WebForms instead of MVC. I've found some examples but they're rather incomplete (require me to declare the columns in both js and codebehind, don't feature paging, no multi-filtering, etc) 回答1: Jquery and page methods in WebForms

Get an enumerated field from a string

我的未来我决定 提交于 2020-01-05 03:05:12
问题 Bit of a strange one this. Please forgive the semi-pseudo code below. I have a list of enumerated values. Let's say for instance, like so: public enum Types { foo = 1, bar = 2, baz = 3 } Which would become, respectfully, in the code: Types.foo Types.bar Types.baz Now I have a drop down list that contains the following List Items: var li1 = new ListItem() { Key = "foo" Value = "Actual Representation of Foo" } var li2 = new ListItem() { Key = "bar" Value = "Actual Representation of Bar" } var

Get an enumerated field from a string

China☆狼群 提交于 2020-01-05 03:04:14
问题 Bit of a strange one this. Please forgive the semi-pseudo code below. I have a list of enumerated values. Let's say for instance, like so: public enum Types { foo = 1, bar = 2, baz = 3 } Which would become, respectfully, in the code: Types.foo Types.bar Types.baz Now I have a drop down list that contains the following List Items: var li1 = new ListItem() { Key = "foo" Value = "Actual Representation of Foo" } var li2 = new ListItem() { Key = "bar" Value = "Actual Representation of Bar" } var

ASP.Net webform generated Excel File to local PC and not server

天涯浪子 提交于 2020-01-04 13:05:18
问题 Following on from a question about generating Excel files, I need to be able to create the file locally while the webform app is located on the remote web server. This is not anything I've dealt with before, so I am finding it difficult exactly what to ask. I am using WebForms on VS2010 with c#. eanderson pointed me in the direction of Simplexcel by Michael Stum which seems to do the trick but the file is generated on the server (or should I says 'tries to' as it is not permitted!!!). 回答1:

Mixing Razor Views and Web Forms Master Pages

允我心安 提交于 2020-01-04 07:54:09
问题 I'm attempting to do what Scott Hanselman describes below: http://www.hanselman.com/blog/MixingRazorViewsAndWebFormsMasterPagesWithASPNETMVC3.aspx I have a Web Form user control with code behind that is called from the Web Form and Razor Master Pages that is not working in the Razor layout: <div id="navtop"> @{ Html.RenderPartial("~/Controls/MasterPageMenu.ascx"); } </div> The user control contains the following: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MasterPageMenu.ascx