.net

Multiple XmlElement attributes on same property/class/...

I'm putting several legacy web services and the current web service into the same back end. But I have to keep the old web services compatible with there old interface. So my question: Is there a way I can set several attributes on, for example, a property? Like this: [XmlElement("AvailableFrom",... what I need...)] [XmlElement("Ava...

Parsing XML result from a Web Service

I'm new to Web Services and XML and was tasked to parse an XML response packet returned. What's the best way to parse an XML result in C#.NET? I need to bind to a data grid as the end result from a search query. ...

WCF service with PHP client - complex type as parameter not working

Hi, I have a WCF service with three methods. Two of the methods return custom types (these work as expected), and the third method takes a custom type as a parameter and returns a boolean. When calling the third method via a PHP soap client it returns an 'Object reference not set to an instance of an object' exception. Example Custom...

What's the best way to call INotifyPropertyChanged's PropertyChanged event ?

When you implement the INotifyPropertyChanged interface, you're responsible for calling the PropertyChanged event each and everytime a property is updated in the class. This typically leads to the following code : public class MyClass: INotifyPropertyChanged private bool myfield; public bool MyField { ...

How can I specify an optional capture group in this RegEx?

How can I fix this RegEx to optionally capture a file extension? I am trying to match a string with an optional component, but something appears to be wrong. (The strings being matched are from a printer log.) My RegEx (.NET Flavor) is as follows: .*(header_\d{10,11}_).*(_.*_\d{8}).*(\.\w{3,4}).* --------------------------------------...

ASP.NET MVC : AJAX ActionLink- Target an HTML attribute

I have an Ajax actionlink that requests a string in the controller method. I want to insert that string into an attribute of a hyperlink. HOw do I specify the attribute field of the target id element? <img id="CHANGE-MY-SRC" src=ViewData["src"] > <%=Ajax.ActionLink("Change IMG Source","actionChange",new AjaxOptions() UpdateTar...

Is it bad practice to use LinkButtons as hyperlinks?

I have a web app with a start page composed of various links. I used the LinkButton control of System.Web.UI.WebControls for these links. I do a little bit of processing on postback, then I redirect to the appropriate page. The problem I find is that in IE7 I cannot right click the "link" and open in a new tab. The postback occurs ...

Does a method that returns a collection get called in every iteration in a foreach statement in C#?

Hi, I was working with some C# code today in the morning and I had something like: foreach(DataRow row in MyMethod.GetDataTable().Rows) { //do something } So, as I dont have a full understanding of the language framework I would like to know if GetDataTable() gets called each time an iteration is done or if it just gets called once an...

ASP.NET MVC Html.ActionLink result URL - the way of encoding

Hi All, I create an amount of actions in MVC controllers. public ActionResult DoSmth1(string token) public ActionResult DoAnother2(string token) And when I have to call ActionLink.. =Html.ActionLink<SomeController>( x=> x.DoSmth(item.property), item.property) =Html.ActionLink<AnotherController>( x=> x.DoAnother(item.property), item....

Run STSADM from ASP.NET under _layouts

Is it possible to run STSADM from an ASP.NET application that is residing in the _layouts folder? I have copied this code on this page. When it runs the return message is Access Denied. ...

.NET mshtml: How to pass a BSTR SAFEARRAY?

The class mshtml.HTMLDocumentClass in Microsoft.mshtml.dll assembly has a method: public virtual void write(params object[] psarray); Avoiding the real question for a moment, what code would you use to call write()? Would you use: String html = "<html><body>Hello, world!</body></html>"; mshtml.HTMLDocumentClass doc; ... doc.write(htm...

Tool to help identify which parts of a common DLL are used by only one project? (.NET)

Our group has a "tools library" DLL that several of our internal projects (all C#) make use of. I've developed the intuition that a good chunk of the tools library is used only by one of the projects -- let's call that project "Project A". Are there any .NET tools that can examine the tools DLL and all the projects (maybe the project EXE...

How to correctly ShowDialog() from inside an MDIChild form?

I have an MDIChild form that needs to show a dialog. I'm currently doing it like this from inside the mdichild form... f.ShowDialog(Me) Should I be using f.ShowDialog(mdiparent)? What is the difference when setting the owner before calling showdialog()? Thanks. ...

Is there .NET equivalent to Delphi's ActionList?

We're currently using Delphi 5 and Delphi 2005 for development, and investigate of going the .NET route via Delphi Prism. Is there a .NET equivalent to Delphi's ActionList? For those not familiar with ActionList, it's a component that contains a collection of actions that we create, e.g. Save, Refresh, Load, etc. Each action can have ...

How to get a 'codebehind' file for an ASP.NET-MVC View in RC1 to be created by default

In RC1 the behavior of the template for creating a view changed. As explained by Scott Gu's post about the release candidate a newly created aspx view doesn't have a code-behind file by default anymore. Based on feedback we’ve changed view-templates to not have a code-behind file by default. This change helps reinforce the pu...

Earliest access to the .net lifecycle

After looking at the .net on IIS7 application lifecycle: http://msdn.microsoft.com/en-us/library/ms178473.aspx For maximum performance, I want to find a way to get my code started as soon as the HttpContext object is created but before HttpApplication is. (it's easy to run code after the HttpApplication class is loaded but before any ...

Pad a number with starting zero in .Net

Hi, I have a requirement to pad all single digits numbers with a starting zero. Can some one please suggest the best method? (ex 1 -> 01, 2 -> 02, etc) ...

Where are the operations for String , Int32, etc are defined?

I was looking at the String and Int32 types through the reflector but couldn't find any operators that are defined. If they aren't defined, how do +/-, etc works on these types? ...

wsdl.exe /sharetypes

I'm working with multiple third party webservices (from the same vendor) that appear to be using the same object structure server side. One of the services allows me to query a list of users by role, and another allows me to query a single user by ID. In order to get this to work the best way possible, the users returned from both serv...

Regex: Do not match if pattern at the end of the string

I have the following regex, where I want to match any explicit dot followed by one or more: <b> <i> <u> </b> </i> </u> I would like this Regex to NOT match this pattern if it occurs at the end of the string. string = Regex.Replace(string, "\.((<[\/biu]+>)+)", ".$1||") Ex: This <b>should match.</b> allright. This <i><b>shouldn't m...