asp.net-3.5

How to sort ResourceSet in C#

こ雲淡風輕ζ 提交于 2019-11-29 12:20:54
I have a resource file named filetypes.resx. Some how I figured out to bind the resource values to dropdownlist, but I don't know how to sort the values of ResourceSet . Here is what I did so far, FileTypes.resx Name,Value A,1 B,2 C,3 code to bind dropdownlist DropDownList1.DataSource = Resources.FileTypes.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true); DropDownList1.DataTextField = "Key"; DropDownList1.DataValueField = "Value"; DropDownList1.DataBind(); Result A C B As you can see the result is not sorted. Please help me to solve this issue. Many

Using ExtJS with ASP.NET, Webforms or MVC?

穿精又带淫゛_ 提交于 2019-11-29 11:12:08
For a scenario using 0 ASP.NET controls at all but rather an 100% extJS interface, what would be the advantages of using ASP.NET MVC or ASP.NET WebForms? And the disadvantages? Is there a OBVIOUS way to do it properly? I would love to have feedback's on your experiences. Thank you! WebForms + any purely client-side framework will give you nothing but endless headaches, if you can get it working at all. Some of the issues I've had in the past (off the top of my head, it's been a while): WebForms limits you to a single <form> tag per page. While this does not necessarily prevent use of Ext or

Can I split system.serviceModel into a separate .config file?

半腔热情 提交于 2019-11-29 11:08:28
问题 I want to separate my system.serviceModel section of the web.config into a separate file to facilitate some environment settings. My efforts have been fruitless. When I attempt it using this method. The wcf code throws an exception: "The type initializer for 'System.ServiceModel.ClientBase 1 threw an exception. Can anyone tell me what I am doing wrong? Web.config: <configuration> <system.serviceModel configSource="MyWCF.config" /> .... MyWCF.config: <system.serviceModel> <extensions> ... <

Linq: Get a list of all tables within DataContext

人盡茶涼 提交于 2019-11-29 09:33:31
问题 I have a DataContext (Linq to Sql) with over 100 tables, is it possible to get a list of all those tables and lets say print them to the console? This might be a silly question. Thanks. 回答1: It's much easier than above and no reflection required. Linq to SQL has a Mapping property that you can use to get an enumeration of all the tables. context.Mapping.GetTables(); 回答2: You can do this via reflection. Essentially, you iterate over the properties in your DataContext class. For each property,

The Just-In-Time debugger was launched without necessary security permission

廉价感情. 提交于 2019-11-29 06:10:36
问题 We are working on vs 2010 windows 7, 32 bit and the project is running under target framework 3.5. Now we are implementing credit card process in the website project in signup page. It's running fine when running from VS IDE, but after publishing to the local IIS when clicked on signup button, it's showing this error: An unhandled win32 exception occured in w3wp.exe The Just-In-Time debugger was launched without necessary security permissions. To debug this proces, the JIT debugger must be

Get item count of a list<> using Linq

▼魔方 西西 提交于 2019-11-29 05:38:58
I want to query a List<> and find out how MANY items match the selection criteria. using LINQ and c# /.net 3.5. How would I modify the query to return an int count. var specialBook = from n in StoreDisplayTypeList where n.DisplayType=="Special Book" select n; var numSpecialBooks = StoreDisplayTypeList.Count(n => n.DisplayType == "Special Book"); This uses an overload of Enumerable.Count that takes a Func<TSource, bool> predicate to filter the sequence. Try this: int specialBookCount = (from n in StoreDisplayTypeList where n.DisplayType=="Special Book" select n).Count() But if you need data as

The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo'

故事扮演 提交于 2019-11-29 05:33:25
问题 I have been working away for the last 7 months on a C# ASP.NET using Visual Studio 2008 and SQL Server 2008. Today, I was running part of my application which was previously running and I got the following error: The SELECT permission was denied on the object 'Address', database 'CNET_85731', schema 'dbo'. I walked through my code and discovered that this error was being caused in the following User Control: protected void sdsAddressesList_Selected(object sender, SqlDataSourceStatusEventArgs

Access a control inside a the LayoutTemplate of a ListView

a 夏天 提交于 2019-11-29 05:28:56
How do I access a Control in the LayoutTemplate of a ListView control? I need to get to litControlTitle and set its Text attribute. <asp:ListView ID="lv" runat="server"> <LayoutTemplate> <asp:Literal ID="litControlTitle" runat="server" /> <asp:PlaceHolder ID="itemPlaceHolder" runat="server" /> </LayoutTemplate> <ItemTemplate> </ItemTemplate> </asp:ListView> Any thoughts? Perhaps via the OnLayoutCreated event? Try this: ((Literal)lv.FindControl("litControlTitle")).Text = "Your text"; The complete solution: <asp:ListView ID="lv" OnLayoutCreated="OnLayoutCreated" runat="server"> <LayoutTemplate>

Edit config custom section in IIS

北城余情 提交于 2019-11-29 03:14:58
问题 I am working on big ASP.NET project(we using ASP.NET 3.5) which comprised of 5 different WebSites and some shared assemblies. Recently I added custom section into web.config files for each site. When I deploy all these applications, each site is deployed separately under same app pool. Is there any way to make this section editable in IIS on site level, just like you can edit ConnectionString section for each site? Sections I added all look like this: <sectionGroup name=

Check that email address is valid for System.Net.Mail.MailAddress

Deadly 提交于 2019-11-29 02:51:37
Currently, to avoid errors from being thrown up due to invalid email addresses, I do the following: Dim mailAddress As MailAddress Try mailAddress = New MailAddress("testing@invalid@email.com") Catch ex As Exception 'Invalid email End Try However, rather than depending on Try..Catch , is there a way of validating that the email address will be 100% valid for the MailAddress type? I know there a plenty of regex functions out there for validating emails, but I'm looking for the function which the MailAddress type uses to validate its addresses. Unfortunately, there is no MailAddress.TryParse