webcontrol

How to mock ASP.NET 3.5 to unit test my web controls?

I want to mock ASP.NET 3.5 behavior in order to unit test my WebControls: I want to test how they perform with mock data with existing system of events. Basically I want to test generated result HTML based on input mock data. How to do it? I looked into NMock, but it doesn't suit my needs for 2 reasons: It just runs ASP.NET server in...

How to expose child control style properties in a custom composite WebControl.

I am writing a custom composite WebControl and want to expose styles of child controls it encapsulates to the ASP.NET designer. The code I currently have is similar to the skeleton below (which for simplicity only has one child control). With the code below, I can see property "ChildPanelStyle" in the designer, but when I try to modify...

Supress changing hexadecimal values in webbrowser.Url in c#

Hallo, I have a WebBrowser control webbr initiated and a page loaded. I fill out the fields on the page's form through parsing: HtmlDocument htmldoc = webbr.Document; and so on ... Then: webbr.Url = new Uri("http://www.host.fr/cherche?q_que=%2Barg1+%2Barg2"); htmldoc.GetElementById("Submit_Btn").InvokeMember("click"); S...

CreateChildControls AFTER Postback

I'm creating my own CompositeControl: a collection of MyLineWebControl and a "add" button. When the user press the "add" button, a new MyLineWebControl is added. In CreateChildControls(), I run through my model (some object MyGridOfLines which has a collection of MyLine) and add one MyLineWebControl for each MyLine. In addButton.Click,...

Web User Control og Event

I have a web user control, CreateQuestion.ascx, in ASP.NET. I want an event "QuestionAdded" to fire when a specific button is clicked. I don't want to send any data, I just want to know WHEN the button is fired. My implementation: CreateQuestion.ascx: public event EventHandler QuestionAdded; protected virtual void OnQuestionAdde...

How can I include additional markup within a 'Content' inner property of an ASP.Net WebControl?

I've searched the site and I cannot find a solution for my problem, so apologies if it's already been answered (I'm sure someone must have asked this before). I have written a jQuery Popup window that I've packaged up as a WebControl and IScriptControl. The last step is to be able to write the markup within the tags of my control. I've...

How to insert the ClientID of a div into an OnClientClick event

In the XHTML for a page I have:- <asp:Button ID="bookNowButton" runat="server" CssClass="bookNowButton" OnClientClick="showHideLoggedInDiv('<%=bookingFormDiv.ClientID%>')" /> This breaks. I need the correct syntax or method to insert the bookingFormDiv.ClientID into the control. What needs to be done? ...

Omit Properties from WebControl Serialization

I have to serialize several objects inheriting from WebControl for database storage. These include several unecessary (to me) properties that I would prefer to omit from serialization. For example BackColor, BorderColor, etc. Here is an example of an XML serialization of one of my controls inheriting from WebControl. <Control xsi:ty...

WebControls and IDisposable

Since WebControls inherit from Control which implement IDisposable. Is it necessary to call Dispose or wrap these WebControls in using statements to prevent memory leaks or does ASP.NET automatically handle this? ...

Overriding protected internal methods

I'm rewriting a web application to ASP.Net 4.0 and have included a Menu control (bound to a SiteMap file, naturally). While I'm liking the new RenderingMode property, I'm hating the fact that it automagically includes some javascript at the bottom of your page to animate the menu. My preference would be for greater control using jQuery...

How do web controls know which method to go when an event occurs?

I have a LinkButton in a web control and I want to bind the event at the page where I use this web control. LinkButton's href attribute is renderedas below. javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$CoreContent$Content$scale1", "", false, "", "/thema/fi/product/reviews.aspx", false, true)) It ...

How to retrieve the selected image in Webcontrol/IE with .Net(C#)

Nice! Now I can get the selected text with my IE plugin. Now I have another problem. How to grab the selected Image on the webcontrol/IE???? Thanks I really appreciate the help. ...

CommandEventArgs null value in OnCommand event handler for a Custom WebControl implementing IButtonControl

Hello everyone. I am very sorry for the long title but I really didn't know how to be more self explaining than this. The problem I have is this: I designed and developed a WebControl which consists in a simple set of elements that, combined togheter in the simplest way, defines a custom button. This control is the one I would like to u...

default value in asp.net server control

I have a problem with the default value attribute. When I add my control to page at design mode, default value does not work. This is my code: [DefaultProperty("Text")] [ToolboxData("<{0}:KHTLabel runat=server key=dfd></{0}:KHTLabel>")] public class KHTLabel : Label ,IKHTBaseControl { [Bindable(true)] [Category("Appearance")] ...

Webcontrol in Webservice

I need a Webcontrol (System.Windows.Forms.WebBrowser) in my Webservice, because I have to calculate distances between coordinates and for that I'll use Google Maps (geocoder). With the Webcontrol I could execute my javascript code to calculate the distance (WebControl.Document.InvokeScript). Is there any way to get a webcontrol in a web...

is compiler change the name of function ?

is asp.net compiler change the name of public methods that declares in "web control" ??? ...

Spreadsheet like control in ASP.NET

Do you know any ASP.Net controls like Spread for ASP.NET that can render Excel like pages that has built-in formula evaluation? ...

Is there a way to programatically insert a Windows Forms control into an MSHTML (WebBrowser) instance?

I have an application that uses an embedded IE through the Windows Forms WebBrowser control. I want to embed some .NET controls into the HTML page. There is old support (since .NET 1.0) to use a special classid in an <object> tag (dllname#controlname) but through experimentation I have found that it only works if the dll is served over ...