webforms

Apply Styles window and the ID selector

Hi Apply Styles window shows all the styles available in the attached stylesheet. I thought that I could apply style simply by selecting an element on web page and then click the appropriate style in Apply Styles window. If I click on class selector, then VS does add the CssClass property to web control, but if I click on id selecto...

Why can’t Themes and Master pages be applied dynamically after Page.PreInit event?

Hi 1) I assume Themes can be set programatically only inside Page.PreInit event handler due to the following reasons: if we’d set a Theme inside Page.Init event handler, then by that time ViewState would already be tracked and thus any data applied by Theme would be tracked and marked as dirty ( which would consume lot of bandwidth ...

Problems with Forms and CSS

This is a follow up to this question. I've tried to come up with a solution that allowed me to have in-line labels in a multi-column form, by reading some of the answers provided in the question mentioned above I realized that it was much more simpler than I originally had though, this is my prototype: <!DOCTYPE html> <html xmlns="http:...

I thought Themes should be all about visual presentation?!

hi Themes are control based and not html based – and as a result themes allow you to reuse almost any control property. 1) a) Are there any control properties which affect the visual appearance of the control, but can’t be expressed through CSS? b) If there are such properties, then I assume these properties are translated into H...

Are values are assigned to declarative controls in the following order?

Hi 1) I assume values are assigned to declarative controls in the following order: 1 - First StyleSheetThemes values are assigned to controls 2 - Then controls are assigned declaratively set values 3 - Then Themes are applied ( at the end of Page.PreInit ) 2) In order to set StyleSheetTheme programmatically, we can’t just assign...

How can I change the action a form submits to based on what button is clicked in ASP.NET MVC?

I have a form that looks like the following mock-up (photoshopped from Facebook) for our Messages view on our ASP.NET MVC site. I'm looking to get the "Mark as Unread" and "Delete" functionality working for a form that looks like this. I'm trying to figure out how I can do this with html forms. How do I make hitting the "Mark as Unre...

How do I mock/fake the session object in ASP.Net Web forms?

Is there a way to mock/fake the session object in ASP.Net Web forms when creating unit tests? I am currenclty storing user details in a session variable which is accessed by my business logic. When testing my business logic, in isolation, the session is not available. This seems to indicate a bad design (though im not sure). Should the...

ASP.MVC - ViewData

Is ViewData of MVC is equivalent to ViewState Webforms ? ...

What SQL Server (Express) logins are needed for an ASP.NET MVC site?

For ASP.NET webforms, I have always needed the following server login: [machine_name\ASPNET]. Questions Is this requirement the same for ASP.NET MVC? If not, what do I need? Does it matter what version of SQL Server I'm using? (Currently, I'm running SQL Server Express 2005, but this could change in the future.) Does it matter what ve...

URL rebasing feature

hi 1) With Html elements that don’t have runat = “server” attribute, absolute and relative paths are sent to the browser as they are. But with server controls, Asp.Net runtime provides URL rebasing feature, where URLs ( specified by server controls contained inside Master Pages, Themes or User Controls ) relative to Master pages, The...

vb.net problems posting to web form

I've hit a wall on POST'ing data to a webform :( Below is the code I've adapted from many places (here most recently: http://p2p.wrox.com/asp-net-1-0-1-1-professional/34517-webrequest-webresponse-form-submit-problem-help.html ) Dim url As String = "https://student.ashford.edu/student/" Dim data As String = "username=myusername&...

set image as submit button

i am using following code to set an image as submit button *<input type="submit" src="submit1.jpg" alt="submit Button"onMouseOver="this.src='submit1.jpg'">* but i actually did not know at which place in whole code to put this line of code because i put it after but it is not working at which place i put this code there appear "su...

Few confusing things about WebControl.Style property

Hi 1) WebControl.Style ( MSDN ): Controls have WebControl.Style property that returns a CssStyleCollection, which contains the HTML style attributes to render on the outer tag of the server control. CssStyleCollection ( MSDN ): Any style declared for a particular HTML server control is added to the collection when the cont...

ReSharper hints that I should do static methods in WebForms - Why? Am I missing something?

ReSharper sometimes hints that I can make some of my random utility methods in my WebForms static. Why would I do this? As far as I can tell, there's no benefit in doing so.. or is there? Am I missing something as far as static members in WebForms goes? ...

ASP.NET AJAX JavaScript files served from a static location.

Hi, I realise that this is going to be a fairly niche requirement and will almost certainly raise a few "WTF's" but here goes... Within an ASP.NET Webforms application I need to serve static content from a local client machine in order to reduce up-front bandwidth requirements as much as possible (Security policy has disabled all Brows...

"Could not load type [Namespace].Global" causing me grief.

In my .Net 2.0 Asp.net WebForms app, I have my Global.asax containing the following code: <%@ Application CodeBehind="Global.asax.cs" Inherits="MyNamespace.Global" Language="C#" %> However when I build I get an error stating- Could not load type 'MyNamespace.Global'. This seems to be because the MyNamespace namespace (defined in...

any way to check both request.form and request.querystring in a single call?

Is there a built in collection that checks both request.form and request.querystring ...

Can you determine the name of the route followed from your webforms page?

Hi there, I have a ASP.NET 3.5 webforms project I have enabled routing over. I also have in the project a number of controls doing different things based on what page they are currently being shown in. It would seem that the most straightforward way to control this different behavior is to discover which route was used to load the page...

What properties ( if any ) do controls like GridView and TextBox save in their control state?

hi 1) What properties ( if any ) do controls like GridView and TextBox save in control state? BTW - I assume these controls have their control state enabled by default?! 2) Control needs to call Page.RegisterRequiresControlState ( during Init event ) in order to signal that its control state needs to be persisted. Assuming contro...

Accessing Form elements using ID

This came as a surprise to me but I have a simple form with 3 fields in it. The fields dont have a "name" attribute to it. They instead have an "id" attribute. However. I can still do a var f = document.getElementsByTagName('form')[0]; alert(f.elementID); to access the element. I thought to access form elements in that way, the "name...