If I have a search object with a list of fields, can I, using the System.ComponentModel.DataAnnotations namespace, set it up to validate that at least one of the fields in the search is not null or empty? i.e All the fields are optional but at least one should always be entered.
http://msdn.microsoft.com/en-us/library/aa479332.aspx form this site i download the MSDNElmah.msi.After install this, i get a solution Contain .aspx and web.config file and one dll.This site have some information about this plugin,but it's seems to difficult to me.I can not use it on my Project.I want to use this plugin on my project.Please help me…
I get the below error
Unable to cast object of type 'System.String' to type 'System.Data.DataTable'.
This is the code I'm using
Dim str As String = String.Empty
If (Session("Brief") IsNot Nothing) Then
Dim dt As DataTable = Session("Brief")
If (dt.Rows.Count > 0) Then
For Each dr As DataRow In dt.Rows
…
If I have in my model class a property of type DateTime how can I render it in a specific format - for example in the format which ToLongDateString() returns?
I have tried this...
@Html.DisplayFor(modelItem => item.MyDateTime.ToLongDateString())
...which throws an exception because the expression must point to a property or field. And…
Hey all,
I'm trying my hand at creating a session which stores member information which the application can use to reveal certain navigation and allow access to certain pages and member role specific functionality.
I've been able to assign my MemberLoggedIn object to the session in this way:
//code excerpt start...
MemberLoggedIn…
In the code behind I have a function that returns a List(Of SomeClass):
rptRepeater.DataSource = SomeFunction(SomeVariable)
rptRepeater.DataBind()
In the html I have a basic repeater layout and am using the below code to get the Properties of each object returned.
<%#Databinder.Eval(Container.DataItem, "Parameter1")%
My question is,…
I have a form which contains a series of fields like:
<input type="text" name="User[123]" value="Alice" />
<input type="text" name="User[456]" value="Bob" />
...
Where the index of the User array (123 and 456) are ID's associated with the value. I'm trying to update these values in the controller.
My thinking is that a…
I've an Admin area and I want only Admins to enter the area. I considered adding the Authorized attribute to every controller in the Admin area. Isn't there an elegant solution or is this feature not there in the framework itself?
EDIT:
I'm sorry, I should to have mentioned this before. I'm using a custom AuthorizedAttribute derived…
here is the problem. I have one PC using VS2008 (SP1 ) and another PC using VS2008(normal). I want my .Net projects to be editable in both these PC's. So naturally my projects use .Net 3.5 by default and not .Net 3.5 SP1.
So, Is there a way I can fix my VS2008 (SP1) version to stick to .Net 3.5 and not .Net 3.5 SP1. In project…
I am trying to write a LINQ query which will return true if there are multiple objects which have a property with the same value.
Here is what I have come up with so far:
Formatters.Where(Function(f As DataModel.Formatter) _
Formatters.Select(Function(f2 As…
i have a multiple textboxes in repeater and i will enter value in those textboxes at runtime. and i want sum of all value entered in those textboxes in one label.i want to do this thing using java script. so can u please help me.
I know it's possible to use this information in a winform, wpf or console application. But I rather to determine which user with what roles are running a sepecific method, so I could decide upon them and run different codes.
In addition in a desktop app. how a user can login? Is there any special winform or…
I have a multiline textbox which can contain only 500 characters. Now i want to show the user the number of characters left as they are typing into the textbox as is the case when we use twitter.
Kindly help
int val = lstvRecordsCus.SelectedItems[0].SubItems[0];
The returned value is an int in a string datatype. I need the right hand side to return the value in int instead of string.
I tried Convert.ToInt32, it didn't work. Any idea?
All the values that comes from SelectedItems[0].SubItems[0] is of type int.
Is it possible using Eval? If so, can someone post a short fragment to illustrate? My SqlDataSource returns 1 record with 3 fields, I'd like to Format these into a string. eg:
Record
Field 'Name' = 'Jack'
Field 'Amount' = 100
Field 'Date' = 12.02.2010
asp:Label text should end up being:
Welcome…
I have two actions, one that accepts a ViewModel and one that accepts two parameters a string and an int, when I try to post to the action, it gives me an error telling me that the current request is ambiguous between the two actions.
Is it possible to indicate to the routing system which action is the…
I am working on a Geocoding app where I put the address in the URL and retreive the XML. I need the complete XML response for this project. Is there any other class for downloading the XML from a website that may be faster than using WebClient or HttpWebRequest? Can the XMLReader be used to get the…
I just recently started trying out T4MVC and I like the idea of eliminating magic strings.
However, when trying to use it on my master page for my stylesheets, I get this:
<link href="<%: Links.Content.site_css %>" rel="stylesheet" type="text/css" />
rending like this:
<link…
The other day I got a question about how to call an ASP.NET ASMX Web Service or PageMethods with the POST data from a Web Form (or any HTML form for that matter). The idea is that you should be able to call an endpoint URL, send it regular urlencoded POST data and then use Request.Form[] to…
Validation of user input is integral to building a modern web application, and ASP.NET MVC offers us a way to enforce business rules on both the client and server using Model Validation. The recent release of ASP.NET MVC 3 has improved these offerings on the client side by introducing…
Introduction: In ASP.NET MVC forum I found some question regarding a sample HTML Rich Text Box Editor(also known as wysiwyg).So i decided to create a sample ASP.NET MVC web application which will use a Rich Text Box Editor.…
Pessoal, nunca foi tão fácil fazer deploy de aplicações ASP.NET 4 no VS 2010, é impressionante a facilidade. Para o Road Show eu criei uma conta no provedor orcsweb que já hospeda .NET 4, fiz uma simples aplicação que inclusive lê um banco de dados e a url é…
El próximo Viernes 23 de Marzo a las 8:30 hs en la Universidad Católica Argentina se realizará una nueva edición del Run en Buenos Aires, el evento Microsoft más importante del año. Particularmente, voy a estar junto con Rodolfo Finochietti e Ignacio Lopez…
Developers
often resort to code reuse techniques in their projects. As far as
ASP.NET framework server side programming is concerned classes, class
libraries, components, custom server controls and user controls are
popular code reuse techniques. Modern…