asp.net-4.0

How to read input value from the Request.Form collection by input name

十年热恋 提交于 2019-12-24 13:22:41
问题 I want to be able to read values of HtmlHiddenField controls from the Request.Form collection in a user control on postback. The keys in the collection seem to represent the control's name attribute rather than ID. I can control the ID using the new ClientIDMode property which helps when my user control is placed in different pages thus within different naming containers. But how can I do the same with the name attribute? The HtmlHiddenField.Name property doesn't match the key name in Reqest

WCF : How to Set MaxReceivedMessageSize Quota

核能气质少年 提交于 2019-12-24 11:29:45
问题 I have a WCF Service. I get the following message when I run the client application The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element. Also i added MaxReceivedMessageSize property in related config in client and server projects. My config in client application is : <system.serviceModel> <bindings> <basicHttpBinding> <binding name="RPBasicHttpBinding" allowCookies=

Column freeze in GridView

我只是一个虾纸丫 提交于 2019-12-24 09:05:36
问题 I have a asp .net web application where I use GridView. There is whole lot of data in it, making it to scroll horizontal as well as vertical. Now, I wanted to freeze the first column in it while horizontal scroll is happening. I got some help from the forums online and wrote this particular piece of css style: td.locked, th.locked { position: relative; top: expression(this.offsetParent.scrollTop); background-color: White; } and in the code behind I have this in my grid's RowDataBound event: e

Read file from network location with credentials in asp.net code

[亡魂溺海] 提交于 2019-12-24 03:39:09
问题 I want to read files from a folder that exists on the network. When I try to access this folder manually (from run command giving a path like \\ABCServer\Documents ) it ask me for credentials (username and password). After giving the correct credentials I am able to access/read files. When I try to read the same files from C# code in ASP.NET it gives me an error: Login Failure: unkown username or bad password How can I pass credentials via C# code during reading file? Below is a part of the

ASP.NET Web Site Administration Tool unkown Error ASP.NET 4 VS 2010

微笑、不失礼 提交于 2019-12-24 03:11:14
问题 I was following the MVCMusic tutorial with an machine with full sql server 2008 r2 and full visual studio professional, in ASP.NET 4.0 and when I got to the page where it sets up membership (near page 66) the Web administration tool wont work, i got the following error: An error was encountered. Please return to the previous page and try again. my web config is like this: <connectionStrings> <clear /> <add name="MvcMusicStoreCN" connectionString="Data Source=.;Initial Catalog=MvcMusicStore

alternating row color MVC

僤鯓⒐⒋嵵緔 提交于 2019-12-23 09:43:13
问题 I need to design a table with alternating row colors. Below is written code but its not working. May be some syntax issue for MVC. Please suggest. @for (int i = 1; i <= 10; i++) { var rowColor = "D9E6C4"; <tr style="background-color:@rowColor;" > <td>apoorva</td> </tr> if (@rowColor.Equals("#ffffff")) { rowColor = "#D9E6C4"; } else { rowColor = "#ffffff"; } } 回答1: Take declaration of rowColor outside for statement. @{ var rowColor = "D9E6C4"; } @for (int i = 1; i <= 10; i++) { <tr style=

Get Parameter Names from SQL Query

混江龙づ霸主 提交于 2019-12-23 08:16:16
问题 The backend is PostgreSQL server 9.1. I am trying to build AdHoc XML reports. The report files will contain SQL queries, all of which must start with a SELECT statement. The SQL queries will have parameters. Depending upon the data type of the associated columns, these parameters will be accordingly presented to the user to provide value(s). A rought SQL query: SELECT * FROM customers WHERE ( customers.customer_code=@customer_code AND customers.location=@location AND customers.type= ( SELECT

ASP.NET 4.0 MVC2 routing on IIS 6

走远了吗. 提交于 2019-12-22 18:54:08
问题 ASP.NET 4.0 MVC2 routing on IIS 6 is not working for me with all the methods used for 3.5 Works fine as long as I build in 3.5 but building in 4.0 and setting the server to use 4.0 I loose my routing. Anyone seen this and been able to resolve it? 回答1: Have you checked to make sure that ASP.NET 4.0 is allowed in the web service extensions after upgrading to .NET 4.0 on the server? See this question. 来源: https://stackoverflow.com/questions/2642403/asp-net-4-0-mvc2-routing-on-iis-6

ValidateRequest=“false” and .NET 4 problem

最后都变了- 提交于 2019-12-22 17:56:38
问题 .NET 4 broke ValidateRequest=“false” for some reason. The solution is -- just put <httpRuntime requestValidationMode="2.0" /> into your web.config file. The problem with that solution is that it breaks support for .NET 2.0! IIS refuses to accept unknown attributes in web.config. Also I don't like the all or nothing nature of this. Can I set requestValidationMode (or in some other way disable request validation) for a single page that needs it? Without breaking backwards compatibility of web

Custom validator fires but does not prevent postback

冷暖自知 提交于 2019-12-22 05:48:16
问题 I've seen a lot of questions about this already, but I'm stumped! Please help! I have a customvalidator. It's firing but it's not preventing postback. Please help me in doing so! I can see that console.log registers before the post. But, it posts back anyway. How do I prevent the postback? I've tried adding a control to validate, and validate empty text equal to true. I also tried adding e.preventdefault, which did not work :( How can I prevent the postback? <script type="text/javascript"> //