dynamic

asp.net FindControl Recursively

给你一囗甜甜゛ 提交于 2019-12-18 08:44:06
问题 This is a really weird one - I will do my best to explain. I have a basic master page: <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="master_MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <asp:ContentPlaceHolder ID="head" runat="server"> </asp:ContentPlaceHolder> </head> <body> <form id="form1" runat=

Create controls dynamically

做~自己de王妃 提交于 2019-12-18 08:31:30
问题 I want to know if this is possible in c# winform. create control when ever button is pressed and place it at given location. I think it is possible like this private TextBox txtBox = new TextBox(); private Button btnAdd = new Button(); private ListBox lstBox = new ListBox(); private CheckBox chkBox = new CheckBox(); private Label lblCount = new Label(); but the problem lies when ever button is pressed same name controls are created.How to avoid that What da........ i wrote and no exception i

C# Newtonsoft.Json.Linq.JValue always returning Int64

放肆的年华 提交于 2019-12-18 07:12:41
问题 I am using the Newtonsoft.Json assembly to de-serialize a Json string into a dynamic object (ExpandoObject). The problem I am having is the int value is always returned as an Int64 where I am expecting an Int32. The code can be seen below. namespace Serialization { using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; using Newtonsoft.Json; using Newtonsoft.Json.Linq; public static class JsonSerializer { #region Public Methods public static string Serialize

Query a table and a column name stored in a table

允我心安 提交于 2019-12-18 07:09:20
问题 I come here because of a problem that I am not experienced enough to solve, in an Oracle Database. Let me explain: The tables I have a table that we'll call Attributes , containing 3 columns : ID , the id of the attribute, -EDIT: Entity_ID as well, the entity it refers to /EDIT- , Table_name , containing the name of the table in which the value of the attribute is stored, and Column_name , containing the name of the column in that table in which is the value is stored. Every tables referenced

Simplest Way To Do Dynamic View Models in ASP.NET MVC 3

别等时光非礼了梦想. 提交于 2019-12-18 07:05:18
问题 Caveat : This might be an inappropriate use of C#'s dynamic keyword and I probably should be using a strongly-typed view model, but... I'm trying to avoid creating a strongly-typed view model by passing a C# 4 dynamic type to my view. I have this in my controller: public ActionResult Index() { var query = from fr in db.ForecastRates join c in db.Codes on new { Code = fr.RateCode, CodeType = "ForecastRate" } equals new { Code = c.CodeValue, CodeType = c.CodeType } select new { RateCode = fr

Dynamic SQL Server Pivot Table

倾然丶 夕夏残阳落幕 提交于 2019-12-18 06:53:12
问题 I found a nice script that dynamically creates by column names for my pivot table, but I am not getting the assigned values back into the table. Here is my starting table. ORDER_ID DSC_NAME NAME ----------- --------------- ----------- 2 34-1500-XXX DWG_DOC 3 C0403 EQIP_1 4 C4054 EQIP_2 1 34-1500-013 PART 0 88-0000 PRCS I run this SQL to generate my columns that I want in my pivot table DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX); select @cols = STUFF((SELECT distinct ',' +

Dynamic SQL Server Pivot Table

时光总嘲笑我的痴心妄想 提交于 2019-12-18 06:52:13
问题 I found a nice script that dynamically creates by column names for my pivot table, but I am not getting the assigned values back into the table. Here is my starting table. ORDER_ID DSC_NAME NAME ----------- --------------- ----------- 2 34-1500-XXX DWG_DOC 3 C0403 EQIP_1 4 C4054 EQIP_2 1 34-1500-013 PART 0 88-0000 PRCS I run this SQL to generate my columns that I want in my pivot table DECLARE @cols AS NVARCHAR(MAX), @query AS NVARCHAR(MAX); select @cols = STUFF((SELECT distinct ',' +

Redshift: Executing a dynamic query from a string

情到浓时终转凉″ 提交于 2019-12-18 05:54:07
问题 I would like to execute a dynamic SQL query stored in a string field on Amazon Redshift. My background is mostly T-SQL relational databases. I used to build SQL statements dynamically, store them into variables and them execute them. I know Redshift can prepare and execute statements, but I wonder if it is possible to execute a query stored in a string field. I have a piece of code that dynamically builds the code below with stats on several tables using pg_* system tables. Every column/table

Why can't I index into an ExpandoObject?

谁说胖子不能爱 提交于 2019-12-18 05:27:11
问题 Something caught me by surprise when looking into C# dynamics today (I've never used them much, but lately I've been experimenting with the Nancy web framework). I found that I couldn't do this: dynamic expando = new ExpandoObject(); expando.name = "John"; Console.WriteLine(expando["name"]); The last line throws an exception: Cannot apply indexing with [] to an expression of type 'System.Dynamic.ExpandoObject' I understand the error message, but I don't understand why this is happening. I

ASP.NET stream content from memory and not from file

情到浓时终转凉″ 提交于 2019-12-18 05:25:52
问题 The users have requested the option to "download" a csv file representation of GridView contents. Does anyone know how to do this without saving the file to the server but rather just streaming it to the user from memory? Thanks 回答1: Implement an IHttpHandler. I used something similar to the following in the ProcessResponse for outputing a CSV that had previously been constructed in a database table... public void ProcessRequest(HttpContext context) { HttpResponse response = context.Response;