.net

Creating Dynamic mdimenu in Windows Application using c#.net

Dear All. Can anybody explain me how to create dynamic menu for my application.i have all parent and child menu details in database which i was not able to create/ add in mdi menu as dynamically. as of now i have created static in mdi form.Please tell how to create dynamically??? ...

Reflection PropertyInfo GetValue call errors out for Collection<> type property.

Hey Guys, I have a propertyInfo object and I try to do a GetValue using it. object source = mysourceObject //This object has a property "Prop1" of type Collection<>. var propInfo = source.GetType().GetProperty("Prop1"); var propValue = prop.GetValue(this, null); // do whatever with propValue // ... I get error at the GetValue() ca...

Does WebClient.OpenFileAsync fire DownloadProgressChanged

According to http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadprogresschanged.aspx, OpenFileAsync should have DownloadProgressChanged firing whenever it makes progress. I can't get it to fire at all. Fires fine with DownloadDataAsync and DownloadFileAsync instead though. Here's a simple example: using System; us...

How does System.TraceListener prepend message with process name?

I have been looking at using System.Diagnostics.Trace for doing logging is a very basic app. Generally it does all I need it to do. The downside is that if I call Trace.TraceInformation("Some info"); The output is "SomeApp.Exe Information: 0: Some info". Initally this entertained me but no longer. I would like to just output "Some in...

GroupBy Count With Subsonic 3

Hi, I like to perform the following with SubSonic 3 without using Linq (using dynamic lookup of columns and tables). Also, no inline sql (to prevent sql-injections). http://www.java2s.com/Code/SQL/Select-Clause/COUNTandGROUPBY.htm mysql> SELECT species, COUNT(*) FROM Bird GROUP BY species; +---------+----------+ | species | COUNT(*) | ...

Need help in javascript code

var radiobox = document.getElementById('<%=rdoRiskAccepted.ClientID%>'); alert(radiobox[0].checked); I am getting undefined as a alert. what am I doing wrong. ...

Adding to an Array

Hi All I have an array: String[] ay = { "blah", "blah number 2" "etc" }; ... But now I want to add to this array at a later time, but I see no option to do so. How can this be done? I keep getting a message saying that the String cannot be converted to String[]. Thank you ...

Serialize a generic collection specifying element names for items in the collection

I have a simple class derived from a generic list of string as follows: [Serializable] [System.Xml.Serialization.XmlRoot("TestItems")] public class TemplateRoleCollection : List<string> { } when I serialize this, I get the following XML: <TestItems> <string>cat</string> <string>dog</string> <string>wolf</string> </TestItems> ...

How to detect double click on WebBrower control?

In a WinForms application I need to detect when the contents of a System.Windows.Forms.WebBrowser is double clicked which in turn opens custom winform dialog box. I note that WebBrowserBase disables the Control.DoubleClick event but I've not worked out how to override this behaviour. ...

How to force HttpWebRequest to use cache in ASP.NET environment?

In my ASP.NET app I use HttpWebRequest for fetching external resources which I'd like to be cached. Consider the following code: var req = WebRequest.Create("http://google.com/"); req.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.CacheIfAvailable); var resp = req.GetResponse(); Console.WriteLine(resp.IsFromCache); var a...

.NET: Can I use DataContractJsonSerializer to serialize to a JSON associative array?

When using DataContractJsonSerializer to serialize a dictionary, like so: [CollectionDataContract] public class Clazz : Dictionary<String,String> {} .... var c1 = new Clazz(); c1["Red"] = "Rosso"; c1["Blue"] = "Blu"; c1["Green"] = "Verde"; Serializing c1 with this code: var dcjs = new DataContractJsonSer...

XSLT compile error when using XslCompiledTransform.Load indirectly called from an application.

I have a component written in C#. Among other things it performs XSL transform on XML data it collects. When I test this feature using another C# project that uses the component it works just fine. However when I export the component as a COM component and try to use this feature from an application it fails on the XslCompiledTransform.L...

Creating Your Own Firefox Add-in with Visual Studio

I need to develop an add-in (as a bar) that will monitor user browsing data using Mozilla Firefox (priority) and other web browsers (Chrome, Safari, etc.). I have already done this using IE, but I need the same for Mozilla Firefox too. Any idea, if this is possible, and how to integrate Firefox add-in with the ability to interact with m...

Clearing forward entries in NavigationService

I have a small sample application hosted in WPF NavigationWindow. It has three pages (A, B, C) and three buttons are available to the user: Back and Forward on Navigation Window and Next on the first page. The first page A contains two radio buttons. Depending which button has been selected by the user Next button will navigate to page...

Extension Method for copying properties form object to another, with first attempt

I'm trying to write an extension method that I can use to copy values from one object property to another object of a different type, as long as the property names and types match exactly. This is what I have: public static T CopyFrom<T>(this T toObject, object fromObject) { var fromObjectType = fromObject.GetType(); ...

Problems with .net and toolbar, menu & status bar rendermode (blue) and standard form (grey)

Hiya, I'm a bit of a newbie to .NET so please ignore my ignorance. If you look at the above image (a complete prototype, ignore black bits :)) you will see lovely menus, toolbars & statusbars all using windows XP render mode and in a funky blue. Look at the form, labels, checkboxes and other buttons and you see horrible old school win...

DBTransaction Rollback throws

Looking into the documentation it says that the Rollback method can throw when the transaction is not in pending state (after begin transaction and before commit transaction). I can't seem to find a way to check whether the transaction can be rollback or not. There isn't a state property either. ...

Process.Start("IExplore.exe"); <-- Is this reliable ?

Process.Start("IExplore.exe"); Does this always work, on every machine ? If not, how to do it properly ? ... EDIT: ................................. The problem with Process.Start("http://www.example.com/"); is that we have to target a local html file, with some querystring specifying which page to load in the html frameset. So our UR...

Need help regarding query string in asp.net

I have a page create-quote.aspx. I want to open this page in different modes, depending on whether a querystring parameter is present or not. My question is at which event should I check, If I have a querystring parameter or not. I think, it should be preinit, what do you say. ...

Digital Signature using CAPICOM needs to be 1024 bits long

We are trying to sign documents using RSA-SHA1 hash. We have tried using the Crypt32 lib and we are getting signature (DS) length of 1024 bits (172 bytes after BASE-64) which is proper. When we try to do the same with CAPICOM, the length comes to be 2292 bytes (BASE-64). How can we have DS length of 172 while using CAPICOM? ...